1

I have a Google Cloud Function (python) that iterates through a dataset and triggers other Google Cloud Functions (within the iteration) if certain criteria are met.

Is there a way to send HTTP POST requests to a cloud function without waiting for a response? Waiting for a response is slowing my iterator function down.

I've been exploring the timeout parameter in the requests module but it doesn't seem to be working.

requests.post(function_trigger,headers=headers,data=json.dumps(payload), timeout=0.5)

Any ideas?

siamsot
  • 1,501
  • 1
  • 14
  • 20
Matt
  • 149
  • 1
  • 9

1 Answers1

0

You can do asynchronous requests using Python libraries such as aiohttp or asyncio which you'll find a small example on how to use in Cloud Functions in this Stackoverflow answer.

You can also achieve asynchronous functionality integrating your function with Cloud Pub/Sub or Cloud Tasks.

dhauptman
  • 974
  • 7
  • 14