CUST-WP-0079: first timer fire failed on hub connection reset; retry hub read, reopen T03
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bf41726029
commit
cef70e6fc5
3 changed files with 26 additions and 6 deletions
|
|
@ -8,7 +8,19 @@ normalized, case-insensitive). Uses the sanctioned POST /decisions/{id}/resolve.
|
|||
|
||||
Usage: sync_resolved_decisions.py [--apply] [--hub http://127.0.0.1:8000]
|
||||
"""
|
||||
import argparse, glob, json, os, re, urllib.request
|
||||
import argparse, glob, json, os, re, time, urllib.error, urllib.request
|
||||
|
||||
|
||||
def get_json(url, attempts=3, delay=5):
|
||||
# The workstation hub forward occasionally drops a first request; retry reads only.
|
||||
for i in range(attempts):
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=30) as r:
|
||||
return json.load(r)
|
||||
except (ConnectionError, urllib.error.URLError):
|
||||
if i == attempts - 1:
|
||||
raise
|
||||
time.sleep(delay * (i + 1))
|
||||
|
||||
|
||||
def norm(s):
|
||||
|
|
@ -33,7 +45,7 @@ def main():
|
|||
ap.add_argument("--apply", action="store_true")
|
||||
a = ap.parse_args()
|
||||
known = repo_resolved(a.root)
|
||||
data = json.load(urllib.request.urlopen(f"{a.hub}/decisions/?status=open&limit=500"))
|
||||
data = get_json(f"{a.hub}/decisions/?status=open&limit=500")
|
||||
data = data.get("items", data) if isinstance(data, dict) else data
|
||||
hits = 0
|
||||
for d in data:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue