Skip to content

Commit 9a17d00

Browse files
committed
zephyr: Mark the infinite loops as NoReturn.
1 parent 34b3444 commit 9a17d00

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

zulip/integrations/zephyr/zephyr_mirror_backend.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
from typing import Any, Dict, IO, List, Optional, Set, Text, Tuple, cast
3+
from typing import Any, Dict, IO, List, NoReturn, Optional, Set, Text, Tuple, cast
44
from types import FrameType
55

66
import sys
@@ -232,7 +232,7 @@ def maybe_restart_mirroring_script() -> None:
232232
backoff.fail()
233233
raise Exception("Failed to reload too many times, aborting!")
234234

235-
def process_loop(log: Optional[IO[Any]]) -> None:
235+
def process_loop(log: Optional[IO[Any]]) -> NoReturn:
236236
restart_check_count = 0
237237
last_check_time = time.time()
238238
recieve_backoff = RandomExponentialBackoff()
@@ -767,7 +767,7 @@ def maybe_forward_to_zephyr(message: Dict[str, Any]) -> None:
767767
# whole process
768768
logger.exception("Error forwarding message:")
769769

770-
def zulip_to_zephyr(options: int) -> None:
770+
def zulip_to_zephyr(options: int) -> NoReturn:
771771
# Sync messages from zulip to zephyr
772772
logger.info("Starting syncing messages.")
773773
backoff = RandomExponentialBackoff(timeout_success_equivalent=120)
@@ -1146,7 +1146,6 @@ def die_gracefully(signal: int, frame: FrameType) -> None:
11461146
# Run the zulip => zephyr mirror in the child
11471147
configure_logger(logger, "zulip=>zephyr")
11481148
zulip_to_zephyr(options)
1149-
sys.exit(0)
11501149
else:
11511150
child_pid = None
11521151
CURRENT_STATE = States.ZephyrToZulip

0 commit comments

Comments
 (0)