public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: jturney@sourceware.org
To: cygwin-apps-cvs@sourceware.org
Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20160705-65-geca884d
Date: Wed, 12 Apr 2017 11:32:00 -0000	[thread overview]
Message-ID: <20170412113244.17877.qmail@sourceware.org> (raw)




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=eca884d381ce3d1ab5e430850ad54b64aec48f14

commit eca884d381ce3d1ab5e430850ad54b64aec48f14
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 12 12:21:44 2017 +0100

    Log exceptions in daemon mode


Diff:
---
 calm/calm.py |   75 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/calm/calm.py b/calm/calm.py
index c01bc1a..0a66074 100755
--- a/calm/calm.py
+++ b/calm/calm.py
@@ -489,42 +489,45 @@ def do_daemon(args, state):
 
         state.packages = {}
 
-        while running:
-            with mail_logs(args.email, toaddrs=args.email, subject='%s' % (state.subject), thresholdLevel=logging.ERROR) as leads_email:
-                # re-read relarea on SIGALRM or SIGUSR2
-                if read_relarea:
-                    read_relarea = False
-                    state.packages = process_relarea(args)
-
-                if not state.packages:
-                    logging.error("not processing uploads or writing setup.ini")
-                else:
-                    if read_uploads:
-                        # read uploads on SIGUSR1
-                        read_uploads = False
-                        state.packages = process_uploads(args, state)
-
-                    do_output(args, state)
-
-                    # if there is more work to do, but don't spin if we can't do it
-                    if read_uploads:
-                        continue
-
-            # we wake at a 10 minute offset from the next 30 minute boundary
-            # (i.e. at :10 or :40 past the hour) to check the state of the
-            # release area, in case someone has ninja-ed in a change there...
-            interval = 30*60
-            offset = 10*60
-            delay = interval - ((time.time() - offset) % interval)
-            signal.alarm(int(delay))
-
-            # wait until interrupted by a signal
-            logging.info("sleeping for %d seconds" % (delay))
-            signal.pause()
-            logging.info("woken")
-
-            # cancel any pending alarm
-            signal.alarm(0)
+        try:
+            while running:
+                with mail_logs(args.email, toaddrs=args.email, subject='%s' % (state.subject), thresholdLevel=logging.ERROR) as leads_email:
+                    # re-read relarea on SIGALRM or SIGUSR2
+                    if read_relarea:
+                        read_relarea = False
+                        state.packages = process_relarea(args)
+
+                    if not state.packages:
+                        logging.error("not processing uploads or writing setup.ini")
+                    else:
+                        if read_uploads:
+                            # read uploads on SIGUSR1
+                            read_uploads = False
+                            state.packages = process_uploads(args, state)
+
+                        do_output(args, state)
+
+                        # if there is more work to do, but don't spin if we can't do it
+                        if read_uploads:
+                            continue
+
+                # we wake at a 10 minute offset from the next 30 minute boundary
+                # (i.e. at :10 or :40 past the hour) to check the state of the
+                # release area, in case someone has ninja-ed in a change there...
+                interval = 30*60
+                offset = 10*60
+                delay = interval - ((time.time() - offset) % interval)
+                signal.alarm(int(delay))
+
+                # wait until interrupted by a signal
+                logging.info("sleeping for %d seconds" % (delay))
+                signal.pause()
+                logging.info("woken")
+
+                # cancel any pending alarm
+                signal.alarm(0)
+        except Exception as e:
+            logging.error("exception %s" % (type(e).__name__), exc_info=True)
 
         logging.info("calm daemon stopped")
 


                 reply	other threads:[~2017-04-12 11:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170412113244.17877.qmail@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).