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

[alert/timer/client] SignedOn unsafe for admin_reload #74

Open
gkistler opened this issue May 30, 2016 · 1 comment
Open

[alert/timer/client] SignedOn unsafe for admin_reload #74

gkistler opened this issue May 30, 2016 · 1 comment
Assignees

Comments

@gkistler
Copy link
Collaborator

Modules need a hook that provides functionality that isn't currently provided by SetupContainer. In pbm_alert's case I ran into an issue where I needed to create a looping timer that queried a database; this isn't currently supported.

Digging in I found that the most direct way to add this functionality would be to simply extend SetupContainer and add query functionality for use in module inits. For the time being I do like how SetupContainer provides reactor-thread-safe versions of Container's methods.

I'm thinking that's what I'll do for now until we address how deeply coupled Factory/Settings/Container/Dispatcher are.

Alternatively I can simply fire a fake SignedOn event on reload/etc, but that seems less intuitive to me.

@Clam-
Copy link
Owner

Clam- commented May 30, 2016

SetupContainer.container might be what you are after? Your .addtimer call could probably be something like:

def init(bot):
    ...
    Timers.addtimer(TIMER_NAME, LOOP_INTERVAL, check_alerts_callback, reps=-1, startnow=False, bot=bot.container)

Just be aware that multiple servers can share the same "database." This might mean that the module in it's current form doesn't act like you might think. I don't think anyone uses that functionality at this point in time though (mainly because I don't currently connect to multiple servers, lol.)
By default multiple servers will share a single database. If you are curious how that works: DBManager._addServer

@gkistler gkistler self-assigned this Sep 30, 2016
@gkistler gkistler added the Bug label Oct 1, 2016
@gkistler gkistler added the Core label Dec 26, 2016
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

2 participants