mirror of
https://github.com/safishamsi/graphify.git
synced 2026-08-28 01:06:36 +00:00
fix(hooks): match the post-checkout log prefix in the timeout fallback
The post-checkout body logs with [graphify] throughout, but the new non-SIGALRM fallback used [graphify hook], so the same timeout read differently depending on the platform. The post-commit body does use [graphify hook] everywhere, so only the checkout copy was wrong. Assert each body uses a single log prefix so this cannot drift again.
This commit is contained in:
+1
-1
@@ -171,7 +171,7 @@ try:
|
||||
signal.alarm(_timeout)
|
||||
else:
|
||||
def _bail():
|
||||
print(f'[graphify hook] graphify rebuild exceeded {_timeout}s', flush=True)
|
||||
print(f'[graphify] graphify rebuild exceeded {_timeout}s', flush=True)
|
||||
os._exit(1)
|
||||
_watchdog = threading.Timer(_timeout, _bail)
|
||||
_watchdog.daemon = True
|
||||
|
||||
@@ -348,6 +348,11 @@ def test_rebuild_bodies_arm_a_timeout_without_sigalrm(name, body):
|
||||
dumped = "".join(ast.dump(stmt) for stmt in fallbacks[0])
|
||||
assert "attr='Timer'" in dumped, f"{name} fallback does not arm a threading.Timer (#2148)"
|
||||
assert "attr='_exit'" in dumped, f"{name} fallback does not kill the stuck rebuild (#2148)"
|
||||
# The fallback logs the timeout itself, because os._exit skips the except
|
||||
# handler that reports it on the SIGALRM path. Its prefix has to match the
|
||||
# rest of the body, or the same event reads differently per platform.
|
||||
prefixes = set(re.findall(r"print\(f'\[([a-z ]+)\]", body))
|
||||
assert len(prefixes) == 1, f"{name} mixes log prefixes {sorted(prefixes)} (#2148)"
|
||||
|
||||
|
||||
def test_detached_launch_targets_graphify_python():
|
||||
|
||||
Reference in New Issue
Block a user