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

auto retry methods, fixes #1260 #2238

Closed
wants to merge 7 commits into from
Closed

Conversation

buckensl
Copy link

@buckensl buckensl commented Sep 5, 2014

fixes #1260

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 90.22% when pulling 574c123 on buckensl:master into db2caf5 on celery:master.

Conflicts:
	celery/backends/mongodb.py
@dewaegw
Copy link

dewaegw commented Jun 21, 2015

+1. Been running this patch for a while and it's working fine.

@thedrow
Copy link
Member

thedrow commented Jun 23, 2015

@buckensl Why is the build failing?
Have you changed something in the code that might cause this?

@@ -43,6 +46,33 @@ def __init__(self, **kw):
self.__dict__.update(kw)


def auto_retry(f):
''' Forces decorated function to retry if mongo throws error '''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be more generic.
I don't think that merging something that is specific to mongo exceptions is useful.

Oh this is just for the mongo backend.
I thought it's for tasks. I will review later on in full detail. Sorry about that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for the mongo backend indeed. I merged in latest changes from master to resolve the conflicts

@ask
Copy link
Contributor

ask commented Jun 29, 2016

We currently don't have the resources to maintain the mongodb result backend :(

There's no one to review this diff that knows MongoDB well enough, but I guess if you can figure
out why the build is passing we can merge it for 5.0.

@ask ask added this to the v5.0.0 milestone Jun 29, 2016
@auvipy auvipy modified the milestones: v5.0.0, 5.1.0 May 10, 2019
@georgepsarakis
Copy link
Contributor

georgepsarakis commented May 22, 2019

From pymongo 3.6 and onwards the retryWrites parameter has been added, for details see here.

From the documentation:

... retryWrites: (boolean) Whether supported write operations executed within this MongoClient will be retried once after a network error on MongoDB 3.6+. Defaults to False.
... Changed in version 3.6: Added support for mongodb+srv:// URIs. Added the retryWrites keyword argument and URI option.

So this option can be passed through the URI.

As far as reads are concerned, I think the caller should be responsible for retrying, handling the exception during a call to .get.

If the above sounds fine, I think we can close this.

@thedrow
Copy link
Member

thedrow commented May 22, 2019

Sounds fine by me.

@thedrow thedrow closed this May 22, 2019
@auvipy auvipy modified the milestones: 5.1.0, 4.4.0 May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: MongoDB AutoReconnect
7 participants