Firebase功能,在用户不活动15分钟后运行 [英] Firebase Functions, run after 15 minutes of user inactivity

查看:70
本文介绍了Firebase功能,在用户不活动15分钟后运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个Firebase呈现系统,如在Firebase中构建呈现文档.现在,我试图在用户离线15分钟或更长时间后清理一些用户数据,但是我不完全确定如何创建此功能以在15分钟不活动后运行.

I have created a firebase presence system as shown in the Build Presence in Firebase doc. Now I am trying to clean up some user data after the user has been offline for 15 minutes or more, but I'm not entirely sure how to create this function to run after 15 minutes of inactivity.

我当时正在考虑使用cronjob,但是我不想继续运行该功能.当用户下线超过15分钟时.另一件事是,如果用户在15分钟后重新登录,则该功能将被取消.有什么想法吗?

I was thinking about using a cronjob, but I didn't want to continuously run the function. Just when the user goes offline for more than 15 minutes. The other thing is that if the user logs back in before the 15 minutes are up, the function would be canceled. Any thoughts?

推荐答案

Cloud Functions当前不提供任何调度机制.这包括cron作业,这些作业可重复运行任何类型的一次性作业,这些作业将被延迟调度.您将必须找到一种在您控制的其他后端的帮助下自己实现此方法的方法,例如

Cloud Functions currently doesn't provide any sort of scheduling mechanism. This includes cron jobs that run repeatedly any sort of one-time jobs to be scheduled on a delay. You will have to find a way to implement this yourself with the help of some other backend you control, such as an App Engine Task Queue.

这篇关于Firebase功能,在用户不活动15分钟后运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆