I-AsSET / retry_push.py
moiaraya's picture
Add files using upload-large-folder tool
fde6d70 verified
Raw
History Blame Contribute Delete
610 Bytes
#!/usr/bin/env python3
import subprocess
import time
import sys
WAIT_SECONDS = 6 * 60 # 6 minutes
def push():
return subprocess.run(
["git", "push"],
stdout=sys.stdout,
stderr=sys.stderr,
)
attempt = 1
while True:
print(f"\n=== Push attempt #{attempt} ===")
result = push()
if result.returncode == 0:
print("\nPush completed successfully!")
break
print(
f"\nPush failed with exit code {result.returncode}."
f"\nWaiting {WAIT_SECONDS//60} minutes before retrying..."
)
time.sleep(WAIT_SECONDS)
attempt += 1