zeromq / majordomo

Majordomo Project
Mozilla Public License 2.0
114 stars 52 forks source link

Disconnecting worker from broker #46

Closed kevinoid closed 10 years ago

kevinoid commented 10 years ago

This pull request fixes #45 by sending DISCONNECT when the worker is destroyed and adding a linger time to ensure the DISCONNECT is actually transmitted.

Unfortunately, although this does address the specific issue of #45, it doesn't address the more fundamental issue of how to "cleanly" disconnect from a broker without losing any requests. At any point the worker calls mdp_worker_destroy there may be more requests which have been sent, or are being sent by the broker, that will be discarded. However, I don't see a way to work around this without adding some sort of advisory disconnect message to the protocol (semantically "I am going to disconnect once I finish currently queued requests, stop sending me more requests"). However, that being said, I think these commits are a step in the right direction.