We are supporting business use cases of multitude of clients who want to utilize Apple Push Notifications. They provide us with KeyId/TeamId and provide us their customer's device tokens to which we send push notifications.
Our service which sends these push notification runs across multiple machines. In order to not generate new JWT tokens unnecessarily often, we generate new token for KeyId/TeamId combination every 40minutes and synchronize it across all machines using concurrency safe DB, the machines then use the same token for KeyId/TeamId pair for the upcoming 40minutes.
It is expected that we may often generate multiple new tokens within 20minutes, as there are multiple unique KeyId/TeamId pairs provided.
From time to time we are receiving sudden spikes of error 429 TooManyProviderTokenUpdates for approximately 40% of our calls to APNS and there was no change to our algorithm.
Is there anything we can do to avoid these errors?
Is there any issue with how we use the APNS?
The sudden spikes in error rates don't appeal to our clients.