Author: sebb
Date: Fri Aug  8 16:03:00 2025
New Revision: 1927699

Log:
Fail on several consecutive errors rather than total

Modified:
   comdev/reporter.apache.org/trunk/scripts/readjira.py

Modified: comdev/reporter.apache.org/trunk/scripts/readjira.py
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/readjira.py        Fri Aug  8 
13:54:30 2025        (r1927698)
+++ comdev/reporter.apache.org/trunk/scripts/readjira.py        Fri Aug  8 
16:03:00 2025        (r1927699)
@@ -38,7 +38,11 @@ __AUTHSTRING = '%s:%s' % ('githubbot', j
 base64string = 
base64.b64encode(__AUTHSTRING.encode(encoding='utf-8')).decode(encoding='utf-8')
 
 JIRATIMEOUT=90 # This may need to be adjusted
-jiraerrors = 0 # count how many errors occurred
+jiraerrors = 0 # count how many consecutive errors occurred
+def clearErrors():
+    global jiraerrors
+    jiraerrors = 0
+
 def handleError():
     global jiraerrors
     jiraerrors += 1
@@ -57,7 +61,8 @@ def getProjects():
         with open(PROJECT_JSON, "w") as f:
             json.dump(x, f, indent=1, sort_keys=True)
             f.close()
-            print("Created %s" % PROJECT_JSON)
+        print("Created %s" % PROJECT_JSON)
+        clearErrors()
     except Exception as e:
         print("Err: could not refresh %s: %s" % (PROJECT_JSON, e))
         handleError()
@@ -73,7 +78,7 @@ def getJIRAS(project):
         rdata = json.loads(urlopen(req, 
timeout=JIRATIMEOUT).read().decode('utf-8'))
         with open(file, "w") as f:
             json.dump([cdata['total'], rdata['total'], project], f, indent=1, 
sort_keys=True)
-            f.close()
+        clearErrors()
         return cdata['total'], rdata['total'], project
     except Exception as err:
         response = ''

Reply via email to