Skip to content

Commit 18e2ada

Browse files
committed
publish DISCONNECT package on stop
1 parent 8efea28 commit 18e2ada

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

moleculer/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ def run(self):
298298
self.stop()
299299
if (self._connection is not None and
300300
not self._connection.is_closed):
301-
# Finish closing
302301
self._connection.ioloop.start()
303302

304303
LOGGER.info('Stopped')
@@ -313,6 +312,12 @@ def stop(self):
313312
314313
"""
315314
LOGGER.info('Stopping')
315+
disconnect_packet = {
316+
'ver': '2',
317+
'sender': self.NODE_ID
318+
}
319+
self._channel.basic_publish(MOLECULER_EXCHANGES['DISCONNECT'], '',
320+
json.dumps(disconnect_packet))
316321
self._stopping = True
317322
self.close_channel()
318323
self.close_connection()

0 commit comments

Comments
 (0)