DevChatterBot icon indicating copy to clipboard operation
DevChatterBot copied to clipboard

After adding/removing commands, commandhandler needs updates

Open benrick opened this issue 6 years ago • 2 comments

When I removed !learn and added a new one, calling it still called the old one.

It seems like the SimpleCommands aren't refreshing.

benrick avatar Jun 26 '18 18:06 benrick

Hi there! I saw your show today so I started digging into some issues. I was going to take a stab at this one, but I see a few options on how to approach this:

  • We have a centralized CommandList as a static property in the application that we keep in sync
  • We implement a caching strategy for the command list and other items, and invalidate the cache upon changes to the SimpleCommands
  • We just do a local check where if commands hasn't been updated in x minutes, we have it reload itself
  • We create a delegate that CommandHandler can register with the CommandsCommand that triggers a refresh when the Commands command is called

I'm up for any. I think the last one can work pretty elegantly, and the caching option will require more thought on what other entities should be cached.

dan-drews avatar Jul 21 '18 20:07 dan-drews

I like the idea of a caching strategy for the SimpleCommands, which would invalidate when changing commands.

benrick avatar Jul 24 '18 21:07 benrick