Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
mypy: Fix types for redis.
Anders Kaseorgdc84e9696caa
diff --git a/zerver/management/commands/check_redis.py b/zerver/management/commands/check_redis.pyindex 39e626c6061..bfa3a7c4294 100644--- a/zerver/management/commands/check_redis.py+++ b/zerver/management/commands/check_redis.py@@ -21,7 +21,7 @@ class Command(BaseCommand):help="Actually trim excess")def _check_within_range(self, key: str, count_func: Callable[[], int],- trim_func: Optional[Callable[[str, int], None]]=None) -> None:+ trim_func: Optional[Callable[[str, int], object]]=None) -> None:user_id = int(key.split(':')[1])user = get_user_profile_by_id(user_id)entity = RateLimitedUser(user)@@ -48,7 +48,7 @@ than max_api_calls! (trying to trim) %s %s", key, count)wildcard_zset = "ratelimit:*:*:zset"trim_func: Optional[- Callable[[str, int], None]+ Callable[[str, int], object]] = lambda key, max_calls: client.ltrim(key, 0, max_calls - 1)if not options['trim']:trim_func = Nonediff --git a/zerver/migrations/0260_missed_message_addresses_from_redis_to_db.py b/zerver/migrations/0260_missed_message_addresses_from_redis_to_db.pyindex 03c15ae7ad4..620ffb38e00 100644--- a/zerver/migrations/0260_missed_message_addresses_from_redis_to_db.py+++ b/zerver/migrations/0260_missed_message_addresses_from_redis_to_db.py@@ -28,16 +28,14 @@ def move_missed_message_addresses_to_database(apps: StateApps, schema_editor: Daredis_client.delete(key)continue- result = redis_client.hmget(key, 'user_profile_id', 'recipient_id', 'subject')- if not all(val is not None for val in result):+ user_profile_id, recipient_id, subject_b = redis_client.hmget(+ key, 'user_profile_id', 'recipient_id', 'subject'+ )+ if user_profile_id is None or recipient_id is None or subject_b is None:# Missing data, skip this key; this should never happenredis_client.delete(key)continue- user_profile_id: bytes- recipient_id: bytes- subject_id: bytes- user_profile_id, recipient_id, subject_b = resulttopic_name = subject_b.decode('utf-8')# The data model for missed-message emails has changed in two