The recommended way to start a single server on a schedule! jobs on geroku?

Is there a way to run a scheduled task on a single server? We have an email task that I don’t want to run twice at the same time. Do you need heroines for this? I'm currently under the impression that play! Jobs actually work for web workers. Thanks!

+4
source share
2 answers

We used Play! (and not on Heroku), and find the easiest way - to determine the frame id for the servers on which you want to run tasks, and the frame identifier for servers that will not start tasks.

In our case, "prodapp" is the production application servers that do not run jobs, and "prodadmin" is the Production Admin / Job server (only one).

We have included the following in our application.conf to disable the jobs plugin on prodapp servers:

%prodapp.plugins.disable=play.jobs.JobsPlugin

I'm not sure if this is the best solution, but, exploring some other options, we determined that this will be the fastest incarnation without branching Play! source.

+6
source

I sent a support ticket to Heroku on the same request. They advised against using Play scheduled tasks, but instead using a scheduler add-in.

I don’t think you can specify the server identifier in Heroku, so you cannot distinguish one web server from another and, therefore, can not only use one instance for such tasks as if you could control the number of servers on which you were spinning.

+2
source

Source: https://habr.com/ru/post/1386237/


All Articles