Minor auto_refresh cleanup
Why are the changes needed?
This pull request is some follow up work from https://github.com/flyteorg/flyte/pull/5767 to clean up auto refresh so that it has a constructor that returns a pointer to the implementation instead of an interface. This gives the user of the constructor more flexibility (ie. for intra-package testing) while still adhering to the auto_refresh interface.
What changes were proposed in this pull request?
The default auto_refresh cache implementation was updated to the InMemoryAutoRefresh and moved into its own file.
Some additional fields were added to improve assertions given the nature of the asynchronous enqueue/syncing that occurs with the auto refresh cache.
Lastly, the new constructor for the in memory auto refresh cache was updated to use the options pattern so that test-only values or non-default options only have to be added in those situations.
The preexisting helper functions to create refresh caches have been left in place for backwards compatibility.
Check all the applicable boxes
- [x] I updated the documentation accordingly.
- [x] All new and existing tests passed.
- [x] All commits are signed-off.
Codecov Report
Attention: Patch coverage is 88.55932% with 27 lines in your changes missing coverage. Please review.
Project coverage is 37.05%. Comparing base (
05c85a8) to head (857af1b). Report is 116 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| flytestdlib/cache/in_memory_auto_refresh.go | 88.55% | 18 Missing and 9 partials :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #5813 +/- ##
=======================================
Coverage 37.05% 37.05%
=======================================
Files 1318 1318
Lines 132583 132604 +21
=======================================
+ Hits 49122 49139 +17
- Misses 79211 79215 +4
Partials 4250 4250
| Flag | Coverage Δ | |
|---|---|---|
| unittests-datacatalog | 51.58% <ø> (ø) |
|
| unittests-flyteadmin | 54.33% <ø> (ø) |
|
| unittests-flytecopilot | 30.99% <ø> (ø) |
|
| unittests-flytectl | 62.29% <ø> (-0.05%) |
:arrow_down: |
| unittests-flyteidl | 7.23% <ø> (ø) |
|
| unittests-flyteplugins | 53.85% <ø> (ø) |
|
| unittests-flytepropeller | 42.66% <ø> (ø) |
|
| unittests-flytestdlib | 55.29% <88.55%> (+0.15%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Thank you for cleaning this up. Apologies on my end for letting this PR sit for a while. Could you resolve the merge conflicts and then we can get this + #5940 merged?
Sure
Should be good for another look @pvditt
Code Review Agent Run #0468bf
Actionable Suggestions - 2
-
flytestdlib/cache/in_memory_auto_refresh.go - 2
- Missing panic recovery in worker goroutines · Line 155-156
- Consider consistent timer stop placement · Line 349-356
Review Details
-
Files reviewed - 3 · Commit Range:
9a40f0a..857af1b- flytestdlib/cache/auto_refresh.go
- flytestdlib/cache/auto_refresh_example_test.go
- flytestdlib/cache/in_memory_auto_refresh.go
-
Files skipped - 0
-
Tools
- Golangci-lint (Linter) - ✖︎ Failed
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Changelist by Bito
This pull request implements the following key changes.
| Key Change | Files Impacted |
|---|---|
| Feature Improvement - Auto-refresh Cache Implementation Refactoring |
- - - |