Skip to content

Commit 7e232d4

Browse files
Removed trailing : from default group name prefix. (#201)
Closes #177.
1 parent 6f8ad5d commit 7e232d4

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGELOG.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Unreleased
1111

1212
* Reduced group_send failure logging level to reduce log noise.
1313

14+
* Removed trailing `:` from default channel layer `prefix` to avoid double
15+
`::` in group keys. (You can restore the old default specifying
16+
`prefix="asgi:"` if necessary.)
17+
1418

1519
2.4.2 (2020-02-19)
1620
------------------

channels_redis/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class RedisChannelLayer(BaseChannelLayer):
193193
def __init__(
194194
self,
195195
hosts=None,
196-
prefix="asgi:",
196+
prefix="asgi",
197197
expiry=60,
198198
group_expiry=86400,
199199
capacity=100,

tests/test_core.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,3 +615,15 @@ async def test_message_expiry__group_send__one_channel_expires_message(channel_l
615615
message = await channel_layer.receive(channel_2)
616616
assert message["type"] == "test.message"
617617
assert message["text"] == "Third!"
618+
619+
620+
def test_default_group_key_format():
621+
channel_layer = RedisChannelLayer()
622+
group_name = channel_layer._group_key("test_group")
623+
assert group_name == b"asgi:group:test_group"
624+
625+
626+
def test_custom_group_key_format():
627+
channel_layer = RedisChannelLayer(prefix="test_prefix")
628+
group_name = channel_layer._group_key("test_group")
629+
assert group_name == b"test_prefix:group:test_group"

0 commit comments

Comments
 (0)