触发远程settimeout云功能请求
我正在使用firebase,无论使用httprequest云函数(连接错误,选项卡或浏览器封闭)),想更新一个值。
我想到了一个Settimeout,但这并不能解决问题,好像发生任何事情一样,请求将失败,因为它与客户端有关。
然后我的想法是在远程服务器上发送请求(有点像CRON作业),该请求应在一定的延迟(假设30分钟)上执行,但这将取消队列中的先前请求(基于用户ID和请求路径)
我怎么能实现这一目标?
示例:
request number 1 -> www.myrequest with { userUID:1, data:{size:1}}
request time:12:01
request number 2 -> www.myrequest with { userUID:1, data:{size:30}}
request time:12:02
请求2取消请求1并在30分钟后执行
I'm using firebase and would like to update a value no matter what happens using a HttpRequest Cloud function ( connection error, tab or browser closed ).
I thought of a setTimeout but this doesn't solve the issue as if anything happens the request will fail as it is related to client side.
Then my idea was to send the request on a remote server ( a bit like a cron job ) that should perform at a certain delay ( let's say 30 minutes ) but that would cancel the previous request in queue ( based on userID and request path )
How could I achieve that and is this possible?
example:
request number 1 -> www.myrequest with { userUID:1, data:{size:1}}
request time:12:01
request number 2 -> www.myrequest with { userUID:1, data:{size:30}}
request time:12:02
request 2 cancels request 1 and gets executed 30 minutes later
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论