I noticed in Cardinal logs that the ticker plugin was having tick() called multiple times at each 15 minute interval. Some of the logs showed the latest configuration, and some showed an older configuration. I also saw that my API usage on IEX had been slowly increasing over the past month. However, a single message was sent to the ticker channel.
I believe that when Cardinal is disconnected from the server, CardinalBotFactory spawns a new instance of CardinalBot, with its own set of plugins. The original CardinalBot instance never has its plugins unloaded, so close() in ticker is never called, and it just keeps chugging along.
We need to make sure we close all plugins when disconnected from a server. The alternative would be to share the PluginManager across multiple CardinalBot instances, but this comes with other issues - namely that any plugin which has stored cardinal (CardinalBot) somewhere on self would have a stale copy of the bot.
I noticed in Cardinal logs that the
ticker
plugin was havingtick()
called multiple times at each 15 minute interval. Some of the logs showed the latest configuration, and some showed an older configuration. I also saw that my API usage on IEX had been slowly increasing over the past month. However, a single message was sent to the ticker channel.I believe that when Cardinal is disconnected from the server, CardinalBotFactory spawns a new instance of CardinalBot, with its own set of plugins. The original CardinalBot instance never has its plugins unloaded, so
close()
in ticker is never called, and it just keeps chugging along.We need to make sure we close all plugins when disconnected from a server. The alternative would be to share the PluginManager across multiple CardinalBot instances, but this comes with other issues - namely that any plugin which has stored
cardinal
(CardinalBot) somewhere onself
would have a stale copy of the bot.