zephyr: Mark the infinite loops as NoReturn.
This commit is contained in:
parent
a20c9cc6d7
commit
7a7cfe637e
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from typing import Any, Dict, IO, List, Optional, Set, Text, Tuple, cast
|
from typing import Any, Dict, IO, List, NoReturn, Optional, Set, Text, Tuple, cast
|
||||||
from types import FrameType
|
from types import FrameType
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -232,7 +232,7 @@ def maybe_restart_mirroring_script() -> None:
|
||||||
backoff.fail()
|
backoff.fail()
|
||||||
raise Exception("Failed to reload too many times, aborting!")
|
raise Exception("Failed to reload too many times, aborting!")
|
||||||
|
|
||||||
def process_loop(log: Optional[IO[Any]]) -> None:
|
def process_loop(log: Optional[IO[Any]]) -> NoReturn:
|
||||||
restart_check_count = 0
|
restart_check_count = 0
|
||||||
last_check_time = time.time()
|
last_check_time = time.time()
|
||||||
recieve_backoff = RandomExponentialBackoff()
|
recieve_backoff = RandomExponentialBackoff()
|
||||||
|
@ -767,7 +767,7 @@ def maybe_forward_to_zephyr(message: Dict[str, Any]) -> None:
|
||||||
# whole process
|
# whole process
|
||||||
logger.exception("Error forwarding message:")
|
logger.exception("Error forwarding message:")
|
||||||
|
|
||||||
def zulip_to_zephyr(options: int) -> None:
|
def zulip_to_zephyr(options: int) -> NoReturn:
|
||||||
# Sync messages from zulip to zephyr
|
# Sync messages from zulip to zephyr
|
||||||
logger.info("Starting syncing messages.")
|
logger.info("Starting syncing messages.")
|
||||||
backoff = RandomExponentialBackoff(timeout_success_equivalent=120)
|
backoff = RandomExponentialBackoff(timeout_success_equivalent=120)
|
||||||
|
@ -1146,7 +1146,6 @@ or specify the --api-key-file option.""" % (options.api_key_file,))))
|
||||||
# Run the zulip => zephyr mirror in the child
|
# Run the zulip => zephyr mirror in the child
|
||||||
configure_logger(logger, "zulip=>zephyr")
|
configure_logger(logger, "zulip=>zephyr")
|
||||||
zulip_to_zephyr(options)
|
zulip_to_zephyr(options)
|
||||||
sys.exit(0)
|
|
||||||
else:
|
else:
|
||||||
child_pid = None
|
child_pid = None
|
||||||
CURRENT_STATE = States.ZephyrToZulip
|
CURRENT_STATE = States.ZephyrToZulip
|
||||||
|
|
Loading…
Reference in a new issue