I have a simple python script that uses Google pubsub to detect new files in the google cloud storage. The script simply adds new messages to a queue where another thread proces
Apart from the flow control suggestion I offered in my previous comment, you could also define a Cloud Function that gets triggered any time a new message is published in a Pub/Sub topic. These Cloud Functions act as subscriptions and will get notified every time a certain event (such as a message being published) occurs.
This tutorial will help you to develop a background Cloud Function that will get triggered when a message is published in a Pub/Sub topic.
In general, there can be several reasons why a subscriber may stop receiving messages:
If your problem does not fall into one of those categories, it would be best to reach out to Google Cloud support with your project name, topic name, and subscription name so that they can narrow down the issue to either your user code, the client library, or the service.
I got stuck 1 hour on this problem, so this is how I fixed my problem :
The GOOGLE_APPLICATION_CREDENTIALS environment variable was setup to a different service account, who wasn't on the right project
project_id = "my_project_sandbox"
And
my_project.json (service account used by project)
{
"type": "service_account",
"project_id": "my_project_prod",
"private_key_id": "---",
"private_key": "---",
...
}