Skip to content

Commit 38ffdeb

Browse files
authored
Used pipeline for message garbage collection (#242)
1 parent b873bda commit 38ffdeb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

channels_redis/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,10 +662,12 @@ async def group_send(self, group, message):
662662

663663
for connection_index, channel_redis_keys in connection_to_channel_keys.items():
664664
# Discard old messages based on expiry
665+
pipe = connection.pipeline()
665666
for key in channel_redis_keys:
666-
await connection.zremrangebyscore(
667+
pipe.zremrangebyscore(
667668
key, min=0, max=int(time.time()) - int(self.expiry)
668669
)
670+
await pipe.execute()
669671

670672
# Create a LUA script specific for this connection.
671673
# Make sure to use the message specific to this channel, it is

0 commit comments

Comments
 (0)