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

Patch: Task De-Serialization uses correct mongo url #2347

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion celery/backends/mongodb.py
Expand Up @@ -95,7 +95,7 @@ def __init__(self, *args, **kwargs):
self.options.setdefault('max_pool_size', self.max_pool_size)
self.options.setdefault('auto_start_request', False)

url = kwargs.get('url')
url = kwargs.get('url') or self.app.conf.get('CELERY_RESULT_BACKEND')
if url:
# Specifying backend as an URL
self.host = url
Expand Down
5 changes: 5 additions & 0 deletions celery/tests/backends/test_mongodb.py
Expand Up @@ -66,6 +66,11 @@ def test_init_settings_is_None(self):
self.app.conf.CELERY_MONGODB_BACKEND_SETTINGS = None
MongoBackend(app=self.app)

def test_init_with_results_backend_and_no_url(self):
self.app.conf.CELERY_RESULT_BACKEND = 'mongodb://myhost:27017/mydb'
backend = MongoBackend(app=self.app)
self.assertEqual(backend.host, self.app.conf.CELERY_RESULT_BACKEND)

def test_restore_group_no_entry(self):
x = MongoBackend(app=self.app)
x.collection = Mock()
Expand Down