Skip to content

Renamed internal methods in core channel layer. #410

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions channels_redis/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ async def send(self, channel, message):
"""
# Typecheck
assert isinstance(message, dict), "message is not a dict"
assert self.valid_channel_name(channel), "Channel name not valid"
assert self.require_valid_channel_name(channel), "Channel name not valid"
# Make sure the message does not contain reserved keys
assert "__asgi_channel__" not in message
# If it's a process-local channel, strip off local part and stick full name in message
Expand Down Expand Up @@ -256,7 +256,7 @@ async def receive(self, channel):
"""
# Make sure the channel name is valid then get the non-local part
# and thus its index
assert self.valid_channel_name(channel)
assert self.require_valid_channel_name(channel)
if "!" in channel:
real_channel = self.non_local_name(channel)
assert real_channel.endswith(
Expand Down Expand Up @@ -377,7 +377,7 @@ async def receive_single(self, channel):
Receives a single message off of the channel and returns it.
"""
# Check channel name
assert self.valid_channel_name(channel, receive=True), "Channel name invalid"
assert self.require_valid_channel_name(channel, receive=True), "Channel name invalid"
# Work out the connection to use
if "!" in channel:
assert channel.endswith("!")
Expand Down Expand Up @@ -482,8 +482,8 @@ async def group_add(self, group, channel):
Adds the channel name to a group.
"""
# Check the inputs
assert self.valid_group_name(group), "Group name not valid"
assert self.valid_channel_name(channel), "Channel name not valid"
assert self.require_valid_group_name(group), "Group name not valid"
assert self.require_valid_channel_name(channel), "Channel name not valid"
# Get a connection to the right shard
group_key = self._group_key(group)
connection = self.connection(self.consistent_hash(group))
Expand All @@ -498,8 +498,8 @@ async def group_discard(self, group, channel):
Removes the channel from the named group if it is in the group;
does nothing otherwise (does not error)
"""
assert self.valid_group_name(group), "Group name not valid"
assert self.valid_channel_name(channel), "Channel name not valid"
assert self.require_valid_group_name(group), "Group name not valid"
assert self.require_valid_channel_name(channel), "Channel name not valid"
key = self._group_key(group)
connection = self.connection(self.consistent_hash(group))
await connection.zrem(key, channel)
Expand All @@ -508,7 +508,7 @@ async def group_send(self, group, message):
"""
Sends a message to the entire group.
"""
assert self.valid_group_name(group), "Group name not valid"
assert self.require_valid_group_name(group), "Group name not valid"
# Retrieve list of all channel names
key = self._group_key(group)
connection = self.connection(self.consistent_hash(group))
Expand Down
Loading