msgpack-rpc / msgpack-rpc-python

MessagePack RPC implementation for Python
205 stars 72 forks source link

Graceful shutdown support #2

Open Leechael opened 11 years ago

Leechael commented 11 years ago

I'm added some codes for graceful shutdown support, may be helpful. :P

repeatedly commented 11 years ago

It is difficult problem.

If use msgpack-rpc-python as a stand alone server, then this code may be helpful.

But msgpack-rpc-python is a library. In this case, library doesn't know an application requirement. An application knows "this signal means", "How to handle this signal", but msgpack-rpc-python doesn't.

What do you think?

Leechael commented 11 years ago

Hi @repeatedly , In my scenario, I'm run msgpack-rpc with Supervisord, and using msgpack-rpc added components to my main service. So when I upgrading my component, I'm using Supervisord send SIGHUP signal to msgpack-rpc server than restart it gracefully. When I have multiple components run base msgpack-rpc, this way added signal handling is the fast way and reduce codes for same job.

I'd like hear some advises from you.