简体   繁体   English

GCP App Engine上的节点cron作业在周末不工作

[英]Node cron job on GCP App Engine not working on weekends

I have a problem executing a cron job in node/express application using node-cron library.我在使用 node-cron 库在 node/express 应用程序中执行 cron 作业时遇到问题。 The application is deployed on Google Cloud App Engine.该应用程序部署在 Google Cloud App Engine 上。

I want to send automatic emails every day at 9 AM, but the cron only work from Monday to Friday.我想每天早上 9 点自动发送电子邮件,但 cron 只在周一到周五工作。

Here is my code:这是我的代码:

 cron.schedule("0 9 * * *", () => {
  sendEmails();
 },{
    scheduled: true,
    timezone: "Europe/Paris"
  });

Thanks谢谢

App Engine standard scales down to 0 instances if there is no traffic, if it happens that at 09:00 saturday/sunday there isn't any instance your Node cron job will not be executed.如果没有流量,App Engine 标准会缩减到 0 个实例,如果发生在周六/周日 09:00 时没有任何实例不会执行您的 Node cron 作业。


Have you checked cron.yaml .你检查cron.yaml Is this the preferred method for scheduling cron jobs in App Engine.这是在 App Engine 中安排 cron 作业的首选方法吗? The sheduling job would be the following: 调度工作如下:

# cron.yaml
cron:
- description: "daily summary job"
  url: /tasks/sendemail
  schedule: every day 09:00

# end cron.yaml

With schedule: every day 09:00 being the specified custom interval使用schedule: every day 09:00是指定的自定义间隔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM