CloudBot
CloudBot copied to clipboard
Config reloading is totally broken in many ways
When editing the config, the bot seems to fail to reload it correctly often, sometimes returning the "no config" error message
[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
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
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.
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.