How can I schedule code to run every few hours in Elixir or Phoenix framework?

前端 未结 7 1331
臣服心动
臣服心动 2020-11-29 14:21

So let\'s say I want to send a bunch of emails or recreate sitemap or whatever every 4 hours, how would I do that in Phoenix or just with Elixir?

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 15:00

    Quantum lets you create, find and delete jobs at runtime.

    Furthermore, you can pass arguments to the task function when creating a cronjob, and even modify the timezone if you're not happy with UTC.

    If your app is running as multiple isolated instances (e.g. Heroku), there are job processors backed by PostgreSQL or Redis, that also support task scheduling:

    Oban: https://github.com/sorentwo/oban

    Exq: https://github.com/akira/exq

    Toniq: https://github.com/joakimk/toniq

    Verk: https://github.com/edgurgel/verk

提交回复
热议问题