Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Shutting down container stat threads in shutdown hook (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
keitwb authored and charless-splunk committed Jun 19, 2017
1 parent f5b2160 commit 9265f7f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dockerplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ def read_callback(self):
'{container}: {msg}')
.format(container=_c(container), msg=e))

def stop_all(self):
for stat_thread in self.stats.values():
stat_thread.stop = True


class CollectdLogHandler(logging.Handler):
"""Log handler to forward statements to collectd
Expand Down Expand Up @@ -705,6 +709,8 @@ def shutdown():
log.info("dockerplugin shutting down")
log.removeHandler(handle)

plugin.stop_all()


# Set up logging
logging.setLoggerClass(CollectdLogger)
Expand Down

0 comments on commit 9265f7f

Please sign in to comment.