community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1728843 - /comdev/projects.apache.org/scripts/cronjobs/pubsubber.py
Date Sat, 06 Feb 2016 14:54:14 GMT
Author: sebb
Date: Sat Feb  6 14:54:14 2016
New Revision: 1728843

URL: http://svn.apache.org/viewvc?rev=1728843&view=rev
Log:
Try gentle shutdown first; don't print stack trace when interrupt occurs during sleep

Modified:
    comdev/projects.apache.org/scripts/cronjobs/pubsubber.py

Modified: comdev/projects.apache.org/scripts/cronjobs/pubsubber.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/pubsubber.py?rev=1728843&r1=1728842&r2=1728843&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/pubsubber.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/pubsubber.py Sat Feb  6 14:54:14 2016
@@ -119,6 +119,9 @@ class daemon:
 
                 # Try killing the daemon process        
                 try:
+                        # Try gentle stop first
+                        os.kill(pid, signal.SIGINT)
+                        time.sleep(0.2)
                         while 1:
                                 os.kill(pid, signal.SIGTERM)
                                 time.sleep(0.1)
@@ -272,7 +275,11 @@ def main():
     svn_thread.start()
     
     while True:
-        time.sleep(60)
+        try:
+            time.sleep(60)
+        except KeyboardInterrupt:
+            print("Detected shutdown interrupt")
+            pass
 
 ##############
 # Daemonizer #



Mime
View raw message