mirror of https://github.com/celery/kombu.git
Fix: Fanout exchange messages mixed across virtual databases in Redis sentinel
This commit is contained in:
parent
a56abf6890
commit
4d281948f2
|
@ -1433,6 +1433,8 @@ class SentinelChannel(Channel):
|
|||
).connection_pool
|
||||
|
||||
def _get_pool(self, asynchronous=False):
|
||||
params = self._connparams(asynchronous=asynchronous)
|
||||
self.keyprefix_fanout = self.keyprefix_fanout.format(db=params['db'])
|
||||
return self._sentinel_managed_pool(asynchronous)
|
||||
|
||||
|
||||
|
|
|
@ -1634,6 +1634,18 @@ class test_RedisSentinel:
|
|||
connection.channel()
|
||||
p.assert_called()
|
||||
|
||||
def test_keyprefix_fanout(self):
|
||||
from kombu.transport.redis import SentinelChannel
|
||||
with patch.object(SentinelChannel, '_sentinel_managed_pool'):
|
||||
connection = Connection(
|
||||
'sentinel://localhost:65532/1',
|
||||
transport_options={
|
||||
'master_name': 'not_important',
|
||||
},
|
||||
)
|
||||
channel = connection.channel()
|
||||
assert channel.keyprefix_fanout == '/1.'
|
||||
|
||||
def test_getting_master_from_sentinel(self):
|
||||
with patch('redis.sentinel.Sentinel') as patched:
|
||||
connection = Connection(
|
||||
|
|
Loading…
Reference in New Issue