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

Cache web template rendered fields for alert and alertgroup endpoints #1261

Merged
merged 8 commits into from
Feb 2, 2023

Conversation

iskhakov
Copy link
Contributor

@iskhakov iskhakov commented Jan 31, 2023

What this PR does

This PR adds same approach as introduced here to all alert and alertgroup endpoints

Which issue(s) this PR fixes

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated

@iskhakov iskhakov marked this pull request as ready for review February 1, 2023 10:41
@iskhakov iskhakov requested a review from a team February 1, 2023 10:41
@iskhakov iskhakov added the pr:no public docs Added to a PR that does not require public documentation updates label Feb 1, 2023
@iskhakov iskhakov changed the title Cache render_for_web and render_for_classic_markdown for aler and ale… Cache web template rendered fields for alert and alertgroup endpoints Feb 1, 2023
Copy link
Contributor

@joeyorlando joeyorlando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good. Wondering if it'd be possible to combine AlertFieldsCacheSerializerMixin and AlertGroupFieldsCacheSerializerMixin as there's quite a bit of overlap in their logic (or maybe extract out most of the logic into a parent class that they both inherit)?

@iskhakov
Copy link
Contributor Author

iskhakov commented Feb 2, 2023

The only difference is the cache invalidation condition, but combining the rest into a single function just made the code less clean. Decided to optimise it next time if we start using this approach elsewhere.

@iskhakov iskhakov merged commit df15175 into dev Feb 2, 2023
@iskhakov iskhakov deleted the cache-other-caclulated-fields branch February 2, 2023 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants