celery/celery — pull request #1888 by magmax (2014-02-24 16:31:42+00:00)
Title: Beat failover

Related to the issue celery#1495

This is another approach for the celery beat failover: use a queue as mutex to allow/disallow the beat execution.

I created the FailoverService class in another file in order to reuse it if necessary in other services.

There are some issues to be solved:

- Make the check timeout customizable.
- Make the queue name customizable.
- Build automatic tests (I have no idea how to check this).
- There can be two near beats whenever the failover happens, because the failover beat will not wait the beat time before getting the master token and launch its own beat.

I checked it this way:
1. Launch a beat.
2. Clone the directory and launch another beat.
3. Shutdown the first one. The second one should start to work.
4. Launch the first one again.
5. Restart Rabbitmq. Any of them should get the mastery (and just one of them).

Any comment is welcome.