dongmi5015 2019-07-26 16:46
浏览 74
已采纳

如何从云功能安排一些事情

I have a serverless app running as google cloud function triggered by bucket object finalize. at the end of the function logic I want to call another action (also function) after exactly one minute (or T time). currently couldn't come up with any way to call another action in one minute and had to use sleep in my app.

the problem with sleep is that I have 60 seconds that the cloud function cost money while no real work is being done.

any suggestion on how to execute something from cloud function in T time so I can just exit from function and save money?

keeping in mind I would like to keep it serverless and using GCP.

  • 写回答

1条回答 默认 最新

  • douba4933 2019-08-16 15:40
    关注

    Use Cloud Tasks with a HTTP target task and schedule_time:

    1. GCS finalize event triggers Cloud Function A
    2. In Cloud Function A, create a HTTP target task with schedule_time = now + 60s and url = URL of Cloud Function B
    3. After a minute has passed, the Cloud Task is scheduled and Cloud Function B will is invoked
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100