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

Kombu does not support multiple hosts in mongodb uri #1795

Closed
romanukes opened this issue Sep 22, 2023 · 0 comments · Fixed by #1796
Closed

Kombu does not support multiple hosts in mongodb uri #1795

romanukes opened this issue Sep 22, 2023 · 0 comments · Fixed by #1796
Milestone

Comments

@romanukes
Copy link
Contributor

CELERY_BROKER_URL = "mongodb://localhost:27021,localhost:27022,localhost:27023/queue?replicaSet=dbrs"

In celery and kombu 5.3.2:

[2023-09-22 21:47:20,747: CRITICAL/MainProcess] Unrecoverable error: ValueError("Port could not be cast to integer value as '27021,localhost:27022,localhost:27023'")
Traceback (most recent call last):
  File "venv/lib/python3.9/site-packages/celery/worker/worker.py", line 203, in start
    self.blueprint.start(self)
  File "venv/lib/python3.9/site-packages/celery/bootsteps.py", line 112, in start
    self.on_start()
  File "venv/lib/python3.9/site-packages/celery/apps/worker.py", line 136, in on_start
    self.emit_banner()
  File "venv/lib/python3.9/site-packages/celery/apps/worker.py", line 170, in emit_banner
    ' \n', self.startup_info(artlines=not use_image))),
  File "venv/lib/python3.9/site-packages/celery/apps/worker.py", line 231, in startup_info
    conninfo=self.app.connection().as_uri(),
  File "venv/lib/python3.9/site-packages/kombu/connection.py", line 725, in as_uri
    connection_as_uri = maybe_sanitize_url(connection_as_uri)
  File "venv/lib/python3.9/site-packages/kombu/utils/url.py", line 112, in maybe_sanitize_url
    return sanitize_url(url, mask)
  File "venv/lib/python3.9/site-packages/kombu/utils/url.py", line 105, in sanitize_url
    return as_url(*_parse_url(url), sanitize=True, mask=mask)
  File "venv/lib/python3.9/site-packages/kombu/utils/url.py", line 70, in url_to_parts
    parts.port,
  File "venv/lib/python3.9/urllib/parse.py", line 186, in port
    raise ValueError(message) from None
ValueError: Port could not be cast to integer value as '27021,localhost:27022,localhost:27023'
@auvipy auvipy added this to the 5.3.x milestone Oct 4, 2023
auvipy pushed a commit that referenced this issue Oct 4, 2023
* Added as_uri method to MongoDB transport, Added tests

* Make flake8 happy

* Removed unnecessary test
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 a pull request may close this issue.

2 participants