I have two google cloud functions. First function has some data and calls instances of second google cloud function for each piece of data. I'm using http post request to pass data from fuction one to function two. Then the second function processes data recieved from first function and save output in bucket. Second function execution take somewhere between 50 to 100 seconds.
I want the first function to make POST request to second function , send the data and not wait 50 to 100 seconds for the execution of second fucntion to finish.
I can set a request timeout but i can't find a way to ensure that delivery of data was successful from first to second function.
Function 1
import requests
someData = [a,b,c,d,e,f..........]
def fucntion1():
for elem in someData:
requests.post('http://SecondFunTionUrl', json={'data' : elem})
return f'Success'
Function 2
def function2(requests):
request_json = request.get_json()
processData(request_json['data']) #takes 100 seconds to finish
return f'Success'