fix: wait for bounded receive scanning during sync pushes
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a1346b-72a4-7d40-b8bd-8b8ca346cfa2
This commit is contained in:
parent
5830ba3c15
commit
7183f5993a
3 changed files with 85 additions and 1 deletions
|
|
@ -36,6 +36,11 @@ from __future__ import annotations
|
|||
import subprocess
|
||||
|
||||
|
||||
# The admitted receive scanner has a 90-second total budget. Leave bounded
|
||||
# headroom for transport and Git hooks; a timeout never proves remote refusal.
|
||||
PUSH_TIMEOUT_SECONDS = 120
|
||||
|
||||
|
||||
def pull_ff(repo_path: str) -> tuple[bool, str]:
|
||||
"""Run ``git pull --ff-only`` on *repo_path*.
|
||||
|
||||
|
|
@ -66,11 +71,13 @@ def push_ff(repo_path: str) -> tuple[bool, str]:
|
|||
try:
|
||||
result = subprocess.run(
|
||||
["git", "-C", repo_path, "push"],
|
||||
capture_output=True, text=True, timeout=30,
|
||||
capture_output=True, text=True, timeout=PUSH_TIMEOUT_SECONDS,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return True, result.stdout.strip() or "pushed"
|
||||
return False, result.stderr.strip() or "push failed"
|
||||
except subprocess.TimeoutExpired:
|
||||
return False, "push timed out; remote outcome unverified; inspect the remote ref before retrying"
|
||||
except Exception as exc:
|
||||
return False, str(exc)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue