简体   繁体   中英

Rails' DelayedJob for a multi-master setup

I want to add one or two servers to my setup. I want it to be a multi-master setup with Postgresql-BDR to be available even if one server crashes.

Now the problem: I use delayed_job pretty heavily. A job should only be run on one server to avoid problems with APIs. I could run the jobs only on one machine, but everything will stop working when that machine crashes.

Does anyone has a nice solution for this case?

I have a solution for this case. I use a custom worker that checks if the job is already running on another server. If it is, it will not run the job. If it is not, it will run the job and set a lock on the job. The lock will be removed when the job is finished.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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