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

chore: Refactor cronjob controller #3029

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented Jan 21, 2025

closes #2954

Refactors the CronjobController logic to deduplicate logic being used across cronjobs and background events.

@hmalik88 hmalik88 marked this pull request as ready for review January 21, 2025 15:39
@hmalik88 hmalik88 requested a review from a team as a code owner January 21, 2025 15:39
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 93.54839% with 2 lines in your changes missing coverage. Please review.

Project coverage is 94.82%. Comparing base (78dd810) to head (f7f4cb5).

Files with missing lines Patch % Lines
...snaps-controllers/src/cronjob/CronjobController.ts 93.54% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3029      +/-   ##
==========================================
+ Coverage   94.80%   94.82%   +0.02%     
==========================================
  Files         503      503              
  Lines       10996    11000       +4     
  Branches     1685     1687       +2     
==========================================
+ Hits        10425    10431       +6     
+ Misses        571      569       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

Choose a reason for hiding this comment

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

I haven't reviewed this in detail. but generally when I proposed we refactor the CronjobController, the main goal I had in mind was to unify the logic used to manage background events and cronjobs.

We currently treat these as entirely separate entities, but I don't think they need to be. My general thought was that we should investigate treating them as one entity with the only variation being non-recurring versus recurring cronjobs (or background events - no strong opinion on the name).

I had intended for the referenced ticket to be to investigate ways to achieve this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR unifies some logic, but I inherently found it hard to make a mental model of both being the same thing because the term non-recurring cronjob in of itself is an oxymoron. Maybe there's a better term to encompass both things. One divergence is that we fetch the cron jobs every time from the manifest, maybe if we can fetch once and unify the state then some of the other logic itself can be refactored. We can keep the original ticket open, I think this is an improvement nonetheless.

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

Successfully merging this pull request may close these issues.

Refactor CronjobController to avoid duplication of logic for cronjobs and background events
3 participants