Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from

Conversation

gregory-m
Copy link
Contributor

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 exception in unregister_worker #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.

Added 2 config values:
1. Qu.max_retries_on_connection_failure - maximum retries on connection failure
   default: 5

2. Qu.retry_frequency_on_connection_failure - retry frequency in seconds between tries.
   Backend will retry to reconnect in current_try_number * frequency.
   e.g.:
   If Qu.max_retries_on_connection_failure = 5 and Qu.retry_frequency_on_connection_failure = 2
   will retry 5 times after 2,4,6,8 and 10 seconds.
   default: 1
Check if all registered workers on own host is launched,
and unregister dead workers.
@gregory-m
Copy link
Contributor Author

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

@gregory-m
Copy link
Contributor Author

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

@bkeepers
Copy link
Owner

bkeepers commented Oct 5, 2011

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
Copy link
Owner

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

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

@bkeepers bkeepers closed this Oct 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants