-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Optimise sync #1641
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
Optimise sync #1641
Conversation
Notably, the touch-after-sync is avoided by using the Maybe controversially, I added the |
Codecov Report
@@ Coverage Diff @@
## master #1641 +/- ##
=========================================
- Coverage 46.95% 46.9% -0.06%
=========================================
Files 119 119
Lines 5143 5151 +8
=========================================
+ Hits 2415 2416 +1
- Misses 2480 2487 +7
Partials 248 248
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty great - haven't tried it out yet but just a few comments.
for _, dst := range files { | ||
args = append(args, dst) | ||
} | ||
delete := exec.CommandContext(ctx, "kubectl", args...) | ||
return []*exec.Cmd{delete} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both copyFn and deleteFn can just return a single exec.Cmd? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No harm in leaving them as slices, but I'm indifferent.
if len(synced) != len(files) { | ||
return errors.New("couldn't sync all the files in " + ns) | ||
} | ||
if numSynced == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this check makes sense anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put this in to pass the "no copy" test at sync_test.go
:410. If you want, both this and the test can be removed.
This PR implements steps 1 and 2 of #1639.