bkeepers / qu

a Ruby library for queuing and processing background jobs.
MIT License
505 stars 50 forks source link

reconnect on Connection Failure in MongoDB + dead workers cleanup on startup #14

Closed gregory-m closed 12 years ago

gregory-m commented 12 years ago

Hi.

  1. Implemented reconnect on Connection Failure in MongoDB backend.

    This is useful in production with replica sets, since it take 2-10 seconds to replica set to elect new master.

    I don't use redis so I don't implemented this for redis adapter.

    Also added 2 config values: Qu.max_retries_on_connection_failure and Qu.retry_frequency_on_connection_failure, it would be great to add them to read me.

  2. Implemented Dead workers cleanup on startup. Used unregister_worker so will not work due issue #13. After you decide what you want to pass to unregister_worker method you need to change worker to worker.id on line 87 in worker.rb if you decide to pass id, or do nothing if you decide to pass worker object.

Thanks.

gregory-m commented 12 years ago

Uffff. "GitHub Flavored Markdown" make me crazy :(.

gregory-m commented 12 years ago

You want to cherry-pick reconnect commit? Or open new pull request only with it?

bkeepers commented 12 years ago

Sorry for the delay on pulling this. I haven't pulled it yet because I don't like the extra options that are currently only mongodb specific being added to the Qu module. I want to refactor a few things to declare most options directly on the backend.

I'll try to get to it today or tomorrow.

bkeepers commented 12 years ago

Merged reconnect code and move config variables directly into backend. 9c4f2be042e9eed59fb2c0063aecc03cc737b8c5

Thanks again for the pull request! How has Qu been working for you?