mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
zephyr_mirror: Pass an encoded stream to hashlib for sharding.
(imported from commit cc57b3956198b66c9cfc84423434a71b8200d819)
This commit is contained in:
@@ -185,6 +185,7 @@ def update_subscriptions_from_humbug():
|
|||||||
return
|
return
|
||||||
streams_to_subscribe = []
|
streams_to_subscribe = []
|
||||||
for stream in streams:
|
for stream in streams:
|
||||||
|
encoded_stream = stream.encode("utf-8")
|
||||||
if stream in current_zephyr_subs:
|
if stream in current_zephyr_subs:
|
||||||
continue
|
continue
|
||||||
if stream in ['security', 'login', 'network']:
|
if stream in ['security', 'login', 'network']:
|
||||||
@@ -192,11 +193,11 @@ def update_subscriptions_from_humbug():
|
|||||||
# to MIT's Zephyr access control settings
|
# to MIT's Zephyr access control settings
|
||||||
continue
|
continue
|
||||||
if (options.shard is not None and
|
if (options.shard is not None and
|
||||||
not hashlib.sha1(stream).hexdigest().startswith(options.shard)):
|
not hashlib.sha1(encoded_stream).hexdigest().startswith(options.shard)):
|
||||||
# This stream is being handled by a different zephyr_mirror job.
|
# This stream is being handled by a different zephyr_mirror job.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
streams_to_subscribe.append((stream.encode("utf-8"), "*", "*"))
|
streams_to_subscribe.append((encoded_stream, "*", "*"))
|
||||||
if len(streams_to_subscribe) > 0:
|
if len(streams_to_subscribe) > 0:
|
||||||
zephyr_bulk_subscribe(streams_to_subscribe)
|
zephyr_bulk_subscribe(streams_to_subscribe)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user