Diff:
---
 calm/calm.py     | 8 ++++++--
 requirements.txt | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/calm/calm.py b/calm/calm.py
index 21cb30f..a5e2b07 100755
--- a/calm/calm.py
+++ b/calm/calm.py
@@ -660,7 +660,7 @@ class Event(Flag):
 def do_daemon(args, state):
     import daemon
     import inotify.adapters
-    import lockfile.pidlockfile
+    import pidlockfile
 
     logging.getLogger('inotify.adapters').propagate = False
 
@@ -678,7 +678,7 @@ def do_daemon(args, state):
         stderr=sys.stderr,
         files_preserve=getLogFileDescriptors(logging.getLogger()),
         umask=0o002,
-        pidfile=lockfile.pidlockfile.PIDLockFile(args.daemon))
+        pidfile=pidlockfile.PIDLockFile(args.daemon))
 
     # XXX: running flag isn't actually doing anything anymore so can be removed
     running = True
@@ -799,6 +799,10 @@ def do_daemon(args, state):
                 logging.error("exception %s" % (type(e).__name__), 
exc_info=True)
             stop_reason = "calm daemon stopped due to unhandled exception"
 
+            # loiter here for a while before exiting, so we don't get punished
+            # by systemd for restarting too quickly...
+            time.sleep(60)
+
         else:
             stop_reason = "calm daemon stopped for unknown reason"
 
diff --git a/requirements.txt b/requirements.txt
index 3cb6f87..62cc827 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,8 +4,8 @@ flake8-bugbear ; python_version >= "3.5"
 flake8-builtins
 flake8-import-order
 license_expression
-lockfile
 markdown
+pidlockfile
 pycodestyle
 python-daemon
 xtarfile[zstd]

Reply via email to