Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalidate MiqProductFeature cache when saving a Tenant record #20708

Closed
wants to merge 1 commit into from

Conversation

skateman
Copy link
Member

This is for now called explicitly using a ui controller endpoint when creating/updating a Tenant. According to @Fryguy it should be done in the backend.

Closes ManageIQ/manageiq-api#928

@miq-bot
Copy link
Member

miq-bot commented Oct 20, 2020

Checked commit skateman@63bd9c2 with ruby 2.6.3, rubocop 0.69.0, haml-lint 0.28.0, and yamllint
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@Fryguy
Copy link
Member

Fryguy commented Oct 20, 2020

I think we need to broadcast this cache busting similar to how we do settings. Otherwise the cache is only invalidated on the worker this is called on. In fact this was likely a bug in the old ui driven call.

@skateman
Copy link
Member Author

Okay, I was hoping that this well be an easy fix 😆 are you saying that the current UI controller endpoint is also just invalidating the cache only on the UI worker?

@Fryguy
Copy link
Member

Fryguy commented Oct 20, 2020

Not sure, but I assume so...I'd have to dig in.

EDIT: Looks like local memory to me

https://github.com/ManageIQ/manageiq/blob/master/app/models/miq_product_feature.rb#L104-L108

@Fryguy
Copy link
Member

Fryguy commented Oct 20, 2020

Broadcasting the invalidation is pretty straightforward...do it locally then do a broadcast, so something like this:

def self.invalidate_caches_queue
  invalidate_caches # invalidate the current worker to reflect the changes immediately
  MiqQueue.broadcast(
    :class_name  => name,
    :method_name => "invalidate_caches"
  )  
end

If we are doing this as part of a callback we probably want to be more selective about it, perhaps only doing it when the actual product features have changes (as opposed to the name of the tenant). Not sure how to go about that, but @kbrock has been doing these kind of optimizations, and can probably help out.

@skateman
Copy link
Member Author

@kbrock can you help us out here?

@miq-bot
Copy link
Member

miq-bot commented Nov 9, 2020

This pull request is not mergeable. Please rebase and repush.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalidating product feature caches when creating a child (ops) tenant
4 participants