Mibew/mibew

The cache is not always updated when a plugin is installed or updated

Closed this issue · 6 comments

I stumbled upon this issue which occurs with plugins that have custom routes defined in their routing.yml file. The behavior is that after the plugin is installed, navigating to the custom route produces in "Not Found" message. After a while the route starts working.

I tested with Mibew 2.1.0 using the Wurrd Authorization API plugin. This issue is intermittent as I couldn't consistently reproduce it. I also couldn't determine how long the "while" is before it starts working. However, a workaround is to delete the "stash" directory under /cache. Navigating to the custom route will cause the cache to be regenerated this time with containing the route information.

As I haven't been able to consistently reproduce it, this is more of a question to you guys.

  1. Is a plugin developer responsible for refreshing the cache after install?
    • If so, how can one do so?
  2. Does the cache refresh itself after a set interval, or is that just some coincidence in my testing?

Thanks,
Eyong

  1. Mibew's Core responsible for cache refreshing. Routes list is removed from cache anytime a plugin is enabled or disabled.
  2. If we talk only about routing its cache has no expiration time.

I appreciate the responses.
Could you point me to a section of code to where the refresh happens? Since this issue is intermittent I want to look at it some more before reporting a bug if necessary.

Thanks,
Eyong

Sure. Here are cache clearing when:

Cache will filled up again then a route is requested.

Thanks. Will do some testing and provide an update.

I've been able to reproduce consistently now. Here are the steps:

  1. Use a plugin that uses configuration properties, and that exposes a route.
  2. Copy the plugin files to the plugin directory
  3. Do not modify the config.yml file.
  4. Go to the plugin page and enable the plugin. The state will say "not initialized"
  5. Navigate to one of the plugin's routes. A "Not found" message will be returned.
  6. Now add the properties to the config.yml file.
  7. Refresh the plugins page. The state will now say "working"
  8. Navigate to the plugin route from above.

If this issue exists, the route will still be returned as "Not found"
If this issue is fixed, the route should start working.

The issue here is that if the plugin is not properly configured, the plugin enable logic doesn't get to clear the cache. When the config properties are entered, the plugin starts working without the cache being cleared. A fix would be either to force the user to enable the plugin again, or to clear the cache if the plugin's state is changing from not initialized to working.

Eyong

Yep, it seems to be a bug. We have to figure out how to solve the problem.