Author: sebb
Date: Sat Jun 14 21:26:55 2025
New Revision: 1926425

URL: http://svn.apache.org/viewvc?rev=1926425&view=rev
Log:
Apply timeout to Kibble requests

Modified:
    comdev/reporter.apache.org/trunk/scripts/rapp/kibble.py

Modified: comdev/reporter.apache.org/trunk/scripts/rapp/kibble.py
URL: 
http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/rapp/kibble.py?rev=1926425&r1=1926424&r2=1926425&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/rapp/kibble.py (original)
+++ comdev/reporter.apache.org/trunk/scripts/rapp/kibble.py Sat Jun 14 21:26:55 
2025
@@ -12,6 +12,8 @@ RAO_HOME = '/var/www/reporter.apache.org
 with open("/usr/local/etc/tokens/kibble.txt", "r") as ft:
     TOKEN = ft.read().strip()
 
+KIBBLE_TIMEOUT = 10
+
 def stats(project, jira = None, mlid = None):
     BEFORE = int(time.time() - (91*86400))
     if not mlid:
@@ -36,6 +38,7 @@ def stats(project, jira = None, mlid = N
         project_subfilter = "/(?:incubator-)?" + project + "(?:-.*)?\\.git"
         # Issues/PRs
         issues = 
requests.post('https://demo.kibble.apache.org/api/issue/issues',
+                  timeout = KIBBLE_TIMEOUT,
                   headers = {
                     'Content-Type': 'application/json',
                     'Kibble-Token': TOKEN,
@@ -81,6 +84,7 @@ def stats(project, jira = None, mlid = N
         
         # Busiest GH issues/PRs
         bissues = requests.post('https://demo.kibble.apache.org/api/issue/top',
+                  timeout = KIBBLE_TIMEOUT,
                   headers = {
                     'Content-Type': 'application/json',
                     'Kibble-Token': TOKEN,
@@ -102,6 +106,7 @@ def stats(project, jira = None, mlid = N
         jira_ts = []
         if jira:
             issues = 
requests.post('https://demo.kibble.apache.org/api/issue/issues',
+                      timeout = KIBBLE_TIMEOUT,
                       headers = {
                         'Content-Type': 'application/json',
                         'Kibble-Token': TOKEN,
@@ -131,6 +136,7 @@ def stats(project, jira = None, mlid = N
         bjiras = []
         if jira:
             bjiras = 
requests.post('https://demo.kibble.apache.org/api/issue/top',
+                      timeout = KIBBLE_TIMEOUT,
                       headers = {
                         'Content-Type': 'application/json',
                         'Kibble-Token': TOKEN,
@@ -147,6 +153,7 @@ def stats(project, jira = None, mlid = N
         
         # Commits
         commits = 
requests.post('https://demo.kibble.apache.org/api/code/commits',
+                  timeout = KIBBLE_TIMEOUT,
                   headers = {
                     'Content-Type': 'application/json',
                     'Kibble-Token': TOKEN,
@@ -171,6 +178,7 @@ def stats(project, jira = None, mlid = N
         
         # Committers
         authors_b = 
requests.post('https://demo.kibble.apache.org/api/code/committers',
+                  timeout = KIBBLE_TIMEOUT,
                   headers = {
                     'Content-Type': 'application/json',
                     'Kibble-Token': TOKEN,
@@ -185,6 +193,7 @@ def stats(project, jira = None, mlid = N
                     }
                  ).json()
         authors_a = 
requests.post('https://demo.kibble.apache.org/api/code/committers',
+                  timeout = KIBBLE_TIMEOUT,
                   headers = {
                     'Content-Type': 'application/json',
                     'Kibble-Token': TOKEN,
@@ -215,6 +224,7 @@ def stats(project, jira = None, mlid = N
         if True:
             ml = r'dev@%s\.apache\.org' % mlid
             emails = 
requests.post('https://demo.kibble.apache.org/api/mail/timeseries-single',
+                      timeout = KIBBLE_TIMEOUT,
                       headers = {
                         'Content-Type': 'application/json',
                         'Kibble-Token': TOKEN,
@@ -229,6 +239,7 @@ def stats(project, jira = None, mlid = N
             
             ml = r'users?@%s\.apache\.org' % mlid
             emails = 
requests.post('https://demo.kibble.apache.org/api/mail/timeseries-single',
+                      timeout = KIBBLE_TIMEOUT,
                       headers = {
                         'Content-Type': 'application/json',
                         'Kibble-Token': TOKEN,
@@ -246,6 +257,7 @@ def stats(project, jira = None, mlid = N
         # This requires 4 months of data because data is compiled into
         # monthly segments, so mid-month requests return skewed data.
         topics = 
requests.post('https://demo.kibble.apache.org/api/mail/top-topics',
+                  timeout = KIBBLE_TIMEOUT,
                   headers = {
                     'Content-Type': 'application/json',
                     'Kibble-Token': TOKEN,


Reply via email to