Skip to content

Commit 517546f

Browse files
authored
Removed obsolete code. (#314)
The following are obsolete: - `channels_redis.core._wrap_close()` since 65a0528. - `channels_redis.core.UnsupportedRedis` since ff8c8e6. - `channels_redis.core.RedisChannelLayer._map_channel_to_connection()` since 9f05013.
1 parent 52e240e commit 517546f

File tree

1 file changed

+0
-57
lines changed

1 file changed

+0
-57
lines changed

channels_redis/core.py

-57
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import logging
88
import random
99
import time
10-
import types
1110
import uuid
1211

1312
import msgpack
@@ -21,23 +20,6 @@
2120
logger = logging.getLogger(__name__)
2221

2322

24-
def _wrap_close(loop, pool):
25-
"""
26-
Decorate an event loop's close method with our own.
27-
"""
28-
original_impl = loop.close
29-
30-
def _wrapper(self, *args, **kwargs):
31-
# If the event loop was closed, there's nothing we can do anymore.
32-
if not self.is_closed():
33-
self.run_until_complete(pool.close_loop(self))
34-
# Restore the original close() implementation after we're done.
35-
self.close = original_impl
36-
return self.close(*args, **kwargs)
37-
38-
loop.close = types.MethodType(_wrapper, loop)
39-
40-
4123
class ChannelLock:
4224
"""
4325
Helper class for per-channel locking.
@@ -74,10 +56,6 @@ def release(self, channel):
7456
del self.wait_counts[channel]
7557

7658

77-
class UnsupportedRedis(Exception):
78-
pass
79-
80-
8159
class BoundedQueue(asyncio.Queue):
8260
def put_nowait(self, item):
8361
if self.full():
@@ -635,41 +613,6 @@ async def group_send(self, group, message):
635613
group,
636614
)
637615

638-
def _map_channel_to_connection(self, channel_names, message):
639-
"""
640-
For a list of channel names, bucket each one to a dict keyed by the
641-
connection index
642-
Also for each channel create a message specific to that channel, adding
643-
the __asgi_channel__ key to the message
644-
We also return a mapping from channel names to their corresponding Redis
645-
keys, and a mapping of channels to their capacity
646-
"""
647-
connection_to_channels = collections.defaultdict(list)
648-
channel_to_message = dict()
649-
channel_to_capacity = dict()
650-
channel_to_key = dict()
651-
652-
for channel in channel_names:
653-
channel_non_local_name = channel
654-
if "!" in channel:
655-
message = dict(message.items())
656-
message["__asgi_channel__"] = channel
657-
channel_non_local_name = self.non_local_name(channel)
658-
channel_key = self.prefix + channel_non_local_name
659-
idx = self.consistent_hash(channel_non_local_name)
660-
connection_to_channels[idx].append(channel_key)
661-
channel_to_capacity[channel] = self.get_capacity(channel)
662-
channel_to_message[channel] = self.serialize(message)
663-
# We build a
664-
channel_to_key[channel] = channel_key
665-
666-
return (
667-
connection_to_channels,
668-
channel_to_message,
669-
channel_to_capacity,
670-
channel_to_key,
671-
)
672-
673616
def _map_channel_keys_to_connection(self, channel_names, message):
674617
"""
675618
For a list of channel names, GET

0 commit comments

Comments
 (0)