Skip to content

nova_get_setting() returns cached results when using queued jobs #182

@nathan-io

Description

@nathan-io

We have jobs which call nova_get_setting(). We're using Laravel Horizon to manage the job queue.

I've found that when you use Nova to change some nova-settings value, nova_get_setting() continues to return the old value until you restart the Horizon process.

Our jobs also run actions which themselves call nova_get_setting(). It returns the old value there as well.

I believe this behavior has the same cause as #158, where I reported that old values persist across a Tinker session, even if you are using the Nova UI to change some setting (and thus conceivably flushing the cache).

Using clearCache() does fix this:

NovaSettings::getStore()->clearCache();
nova_get_setting('some_key'); // now returns current result without needing to restart Horizon

However, I'm hoping to avoid calling this before every call to nova_get_setting(), which seems really messy.

I suppose we could create some helper which first clears the cache and then calls nova_get_setting(), but that doesn't really feel like a great solution either.

Thanks for any insight or assistance you can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions