简体   繁体   English

安排发条仅在一年中的特定日期运行

[英]Schedule clockwork to run only on a specific date of the year

I been trying schedule a job with clockwork to run only on day eg. 我一直在尝试安排clockwork工作,例如仅在一天中运行。 February 14. But I'm not sure if is this possible because the documentation formats do not have this possibility. 2月14日,但是我不确定是否可能,因为文档格式没有这种可能性。

I know that I can do something like this: 我知道我可以做这样的事情:

Clockwork.every(1.day, 'valentines_day_job', if: lambda { |t| t.day == 14 && t.month == 2 })

But I would like to avoid unnecessary verification every day. 但我想避免每天不必要的验证。

Any ideas? 有任何想法吗?

Thank you. 谢谢。

为此,请将1.day更改为1.year

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

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