diff --git a/package_alerts/package_alerts b/package_alerts/package_alerts
index 7ab5557a22c0871985045fa467fdaabd49a802b8..817e06d73691d8f5d74f519f9f3c95aa6718c179 100755
--- a/package_alerts/package_alerts
+++ b/package_alerts/package_alerts
@@ -5,9 +5,11 @@ import glob
 import html
 import json
 import re
+import signal
 import subprocess
 import sys
 import tempfile
+import time
 from collections import ChainMap
 from datetime import datetime
 import dnf
@@ -157,7 +159,13 @@ def get_upstream(token, feed):
     offset = 0
     packages = []
     while True:
-        result = call_api(token, url, params={"limit": 100, "offset": offset})
+        signal.signal(signal.SIGALRM, timeout_handler)
+        signal.alarm(30)
+        try:
+            result = call_api(token, url, params={"limit": 100, "offset": offset})
+        except TimeoutError:
+            print(f"Timeout occurred whilst trying to process {feed} with offset {offset}")
+            continue
         try:
             j = json.loads(result.content)
         except json.decoder.JSONDecodeError:
@@ -258,6 +266,10 @@ def format_release(p, f, token):
         )
         print(f"  -- Payload sent: {payload}", flush=True)
 
+def timeout_handler(num, stack):
+    """ function to handle timeouts for long running function """
+    print("Received SIGALRM")
+    raise TimeoutError
 
 if __name__ == "__main__":
     """this is the main class, it's amazing."""