GCP云功能中是否有任何回调选项?
当完成相关过程时,我正在寻找一种“唤醒”云功能的方法。
要深入了解 - 这些是我拥有的函数 -
1。一个云功能被称为任何x时间,其目的是调用另一个函数(函数#2)。
2。请求信息的外部提供商函数(我不能编辑代码,我只有请求正文)。该信息不会实时收到,但是一旦结束 - 它会发送回调。应该注意的是,该过程可能需要很长时间甚至数小时。
我想创建一个过程,每个X时间函数1都会调用函数2,并且第二次结束后,它将将信息返回到函数1,并将其存储在DB中。
func1的示例代码:
import requests
def entry_point():// func1
response = requests.get('https://outsourceapi.com/get_info')// func2
save_response_in_DB(response.json())// This will happand after getting response
因为我无法保持功能1醒了这么长时间,所以有没有办法再次“唤醒”? 还是另一种解决方案?
I am looking for a way to "wake up" the cloud function when a related process is done.
To understand in-depth - these are the functions I have-
1. A cloud function that gets called any X time and its purpose is to call another function (function # 2).
2. An external provider function that requests information, (I can't edit the code, I have only the request body). The information is not received in real-time, but once it ends - it sends a callback. It should be noted that the process can take long minutes and even hours.
I want to create a process where every X time function 1 will call function 2 and as soon as the second is over it will return the information to function 1 and it will store it in DB.
Example code for func1:
import requests
def entry_point():// func1
response = requests.get('https://outsourceapi.com/get_info')// func2
save_response_in_DB(response.json())// This will happand after getting response
Because I can not keep function 1 awake for so long, is there a way to "wake it up" again?
Or alternatively another solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论