From 05cf04df033ac30968724d1fd21d6c0b8ad08112 Mon Sep 17 00:00:00 2001 From: Ske Date: Sat, 15 Sep 2018 15:12:51 +0200 Subject: [PATCH] Fix webhook stat reporting --- src/pluralkit/bot/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pluralkit/bot/__init__.py b/src/pluralkit/bot/__init__.py index 45914a09..ba186eec 100644 --- a/src/pluralkit/bot/__init__.py +++ b/src/pluralkit/bot/__init__.py @@ -32,6 +32,9 @@ class PluralKitBot: self.stats = NullStatCollector() self.channel_logger = channel_logger.ChannelLogger(self.client) + + # "stats" passed here will be a NullStatsCollector, will get overwritten inside + # the Proxy object when the actual connection occurs self.proxy = proxy.Proxy(self.client, token, self.channel_logger, self.stats) async def on_error(self, evt, *args, **kwargs): @@ -136,6 +139,9 @@ class PluralKitBot: os.environ["INFLUX_DB"] ) + # Overwrite the NullCollector passed to proxy + self.proxy.stats = self.stats + self.logger.info("Starting periodical stat reporting...") asyncio.get_event_loop().create_task(self.periodical_stat_timer(self.pool))