CloudBot icon indicating copy to clipboard operation
CloudBot copied to clipboard

Config reloading is totally broken in many ways

Open dmptrluke opened this issue 10 years ago • 4 comments

When editing the config, the bot seems to fail to reload it correctly often, sometimes returning the "no config" error message

dmptrluke avatar Dec 19 '14 08:12 dmptrluke

[23:47:14] [INFO] Config changed, triggering reload.
[23:47:14] [INFO] [esper|permissions] Reloading permissions for esper.
[23:47:14] [INFO] Config changed, triggering reload.
[23:47:14] [INFO] [esper|permissions] Reloading permissions for esper.
[23:47:14] [INFO] Config changed, triggering reload.
[23:47:14] [INFO] [esper|permissions] Reloading permissions for esper.
[23:47:19] [INFO] Config changed, triggering reload.
[23:47:19] [CRITICAL] No config file found, bot shutting down!
No config file found! Bot shutting down in five seconds.
Copy 'config.default' to 'config.json' for defaults.
For help, see http://git.io/cloudbotirc. Thank you for using CloudBot!
[23:47:42] [INFO] [esper:#cloudbot] <Luke> wot

dmptrluke avatar Dec 21 '14 10:12 dmptrluke

It may be related to how pycharm saves files, but it causes the config reloader to freak out. It does weird things with files: 371e04d

dmptrluke avatar Dec 21 '14 10:12 dmptrluke

After additional checking, it looks like the config reloader is pretty badly-built, it doesn't even have error checking and it responds to any generic filesystem event. It will also sometimes try to reload twice for no real reason. It needs to be enhanced quite a bit.

dmptrluke avatar Dec 21 '14 10:12 dmptrluke

I'd recommend some os.path.getmtime() on an event so you don't trigger on some file that isn't even related to us. If there is a way to slip it into the bot before it gets a message so we can do a check on the loaded config's edit time and the current file then that should fix that problem.

Red-M avatar Oct 16 '15 17:10 Red-M