Firebase/Parse 可以每天在特定时间运行代码吗? [英] Can Firebase/Parse run code at a certain time every day?

查看:35
本文介绍了Firebase/Parse 可以每天在特定时间运行代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Firebase 或 Parse 上设置类似于 cron 作业的内容?有没有办法设置某种对存储的用户数据运行的定时操作?

Is it possible on Firebase or Parse to set up something kinda like a cron job? Is there a way to set up some sort of timed operation that runs over the stored user data?

例如,我正在编写一个程序,允许人们每天回复午餐.如果您在中午之前回复了,那么您将与其他也回复了的人配对.使用 JavaScript,用户可以在浏览器中提交他们的 RSVP.

For example, I'm writing a program that allows people to RSVP for lunch everyday. If you have RSVPed by noon, then you get paired up with somebody else who has also RSVPed. Using JavaScript, the user can submit their RSVP in the browser.

问题是,Firebase/Parse 能否每天中午 12:00 执行代码匹配所有人?

The question is, can Firebase/Parse execute the code to match everyone at 12:00pm every day?

推荐答案

是的,这可以通过 Parse 来完成.您需要将匹配函数编写为 后台作业云代码,然后你需要在仪表板中安排任务.在调度的灵活性方面,它不如 cron 灵活,但你绝对可以每天在同一时间运行一个任务,或者每 x 分钟/小时.

Yes, this can be done with Parse. You'll need to write your matching function as a background job in cloud code, and then you'll need to schedule the task in the dashboard. In terms of the flexibility in scheduling, it's not as flexible as cron but you can definitely run a task at the same time every day, or every x minutes/hours.

任务在被终止之前最多可能需要 15 分钟才能执行,因此根据数据库的大小或任务的复杂性,您可能需要将其分解为不同的任务或使其可恢复.

Tasks can take 15 mins max to execute before they're killed, so depending on the size of your database or the complexity of your task, you may need to break it up into different tasks or make it resumable.

这篇关于Firebase/Parse 可以每天在特定时间运行代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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