So I have a cloud function that subscribes to a Pub/Sub topic, and the function interacts with a 3rd party service API that has a hard rate limit. This creates a problem, when the PubSub topic suddenly gets a surge of incoming traffic, the cloud function will be invoked frequently enough to go over the 3rd party API rate limit.
What's the best way to solve this problem? Am I able to throttle the PubSub topic or I have to implement some backoff logic in the cloud function? Thanks!