[PATCH stateful-chg] commandserver: move _socket state to handler

Jun Wu quark at fb.com
Thu May 18 12:42:44 EDT 2017


Excerpts from Yuya Nishihara's message of 2017-05-18 22:59:37 +0900:
> Can you give some pointers to understand how getsocket() will be used in chg?

  # service.mainloop
  while not shouldexit:
    sock = handler.getsocket()
  # handler.getsocket
  - handler reads IPC, may fork to preload in background
    - the non-forked handler returns the old sock
    - the forked handler does the following:
      - preload
      - atomic replace socket (so the old process will exit)
      - return socket (so service starts to use the new one)

> > -class chgunixservicehandler(object):
> > +class chgunixservicehandler(commandserver.unixservicehandler):
> 
> Nit: I prefer not inheriting methods that are mostly overridden.

Maybe we can use some mixins.


More information about the Mercurial-devel mailing list