Fixing MongoDB backend to work properly with TTL (#1076)

* Fixing MongoDB backend to work properly with TTL
Bumping pymongo version to 3.8.0

* Updating authors

* Adding dependencies to travis config

* Fixing travis test cases

* Changing pymongo version to align with mongo result backend
This commit is contained in:
Marcin Puhacz 2019-08-07 14:06:13 +02:00 committed by Omer Katz
parent 193054d243
commit 0ad7d08c4c
5 changed files with 17 additions and 9 deletions

View File

@ -9,16 +9,19 @@ env:
stages:
- test
- lint
matrix:
include:
- python: 2.7
env: TOXENV=2.7
before_install: sudo apt-get update && sudo apt-get install libgnutls-dev
- python: 3.5
env: TOXENV=3.5
before_install: sudo apt-get update && sudo apt-get install libgnutls-dev
- python: 3.6
env: TOXENV=3.6
before_install: sudo apt-get update && sudo apt-get install libgnutls-dev
- python: 3.7
env: TOXENV=3.7-linux
sudo: true
@ -39,6 +42,7 @@ matrix:
- python: '3.6'
env: TOXENV=apicheck
stage: lint
before_install: sudo apt-get update && sudo apt-get install libgnutls-dev
- python: '3.6'
env: TOXENV=pydocstyle
stage: lint

View File

@ -87,6 +87,7 @@ Luyun Xie <2304310@qq.com>
Mads Jensen <https://github.com/atombrella>
Mahendra M <Mahendra_M@infosys.com>
Marcin Lulek (ergo) <info@webreactor.eu>
Marcin Puhacz <marcin.puhacz@gmail.com>
Mark Lavin <mlavin@caktusgroup.com>
markow <markow@red-sky.pl>
Matt Wise <wise@wiredgeek.net>

View File

@ -20,6 +20,8 @@ from kombu.utils.json import loads, dumps
from kombu.utils.objects import cached_property
from . import virtual
from .base import to_rabbitmq_queue_arguments
E_SERVER_VERSION = """\
Kombu requires MongoDB version 1.3+ (server is {0})\
@ -286,6 +288,9 @@ class Channel(virtual.Channel):
options['readpreference'] = modes[options['readpreference']]
return options
def prepare_queue_arguments(self, arguments, **kwargs):
return to_rabbitmq_queue_arguments(arguments, **kwargs)
def _open(self, scheme='mongodb://'):
hostname, dbname, conf = self._parse_uri(scheme=scheme)
@ -427,11 +432,9 @@ class Channel(virtual.Channel):
return
self.routing.update(
{'queue': queue}, {'$set': {'expire_at': expire_at}},
multiple=True)
{'queue': queue}, {'$set': {'expire_at': expire_at}}, multi=True)
self.queues.update(
{'_id': queue}, {'$set': {'expire_at': expire_at}},
multiple=True)
{'_id': queue}, {'$set': {'expire_at': expire_at}}, multi=True)
def get_now(self):
"""Return current time in UTC."""

View File

@ -1 +1 @@
pymongo>=2.6.2,<3.0
pymongo>=3.3.0

View File

@ -418,7 +418,7 @@ class test_mongodb_channel_ttl(BaseMongoDBChannelCase):
'routing', 'update',
{'queue': 'foobar'},
{'$set': {'expire_at': self.expire_at}},
multiple=True,
multi=True,
)
def test_put(self):
@ -499,13 +499,13 @@ class test_mongodb_channel_ttl(BaseMongoDBChannelCase):
'routing', 'update',
{'queue': 'foobar'},
{'$set': {'expire_at': self.expire_at}},
multiple=True,
multi=True,
)
self.assert_operation_called_with(
'queues', 'update',
{'_id': 'foobar'},
{'$set': {'expire_at': self.expire_at}},
multiple=True,
multi=True,
)