Commits

Jason R. Coombs  committed 4e0d166 Draft

Rewrote comment to explain existing implementation

  • Participants
  • Parent commits a5b8571
  • Branches default

Comments (0)

Files changed (1)

File eggmonster/client/_em_emi.py

                     raise Exception()
                 buf += ret
             except:
-                # We have four potential behaviours that we could implement
-                # here:
+                # Connection to the Eggmonster master has been lost.
                 #
-                #   - wait for master return, then SIGKILL (previous
-                #     behaviour)
-                #   - wait for master return, then SIGTERM
-                #   - SIGKILL immediately
-                #   - SIGTERM immediately (new behaviour)
+                # Existing services will not be able to continue to be
+                # managed by the master, so they necessarily need to be
+                # stopped (it would be nice if they did not).
+                # If the master restarts, it should respawn this
+                # parent process.
                 #
-                # The previous behaviour worked best because it tried to give
-                # the largest level of uptime when a problem occurred.
-                # However,
-                # if you are running stateful and data storage services, you
-                # don't want this to happen. So SIGTERMs might be nice, except
-                # that the wait for clean termination could cause clashes with
-                # resurrecting processes.
-                #
-                # So we'll just go for clean immediate terminations. That
-                # reduces the ability to cope with EM server failure, but
-                # I think it's the best approach.
+                # Send a TERM signal (and not KILL) to politely ask the
+                # child process to terminate. It may continue to run and
+                # finish any open processing (or hang indefinitely if it
+                # does not behave well).
                 logger.info('Connection to master dropped, terminating.')
                 sendsig(child, signal.SIGTERM)
                 raise SystemExit(0)
-                #return die_when_master_returns(child)
 
         cmd, buf = buf.split('\n', 1)
         cmd = cmd.strip()