Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unload plugins when disconnected from server #195

Closed
johnmaguire opened this issue Jul 30, 2021 · 1 comment
Closed

Unload plugins when disconnected from server #195

johnmaguire opened this issue Jul 30, 2021 · 1 comment

Comments

@johnmaguire
Copy link
Owner

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.

@johnmaguire
Copy link
Owner Author

I've been watching IEX API graphs and commit 284e5f9 seems to have resolved this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant