-
Notifications
You must be signed in to change notification settings - Fork 41
*: move redo s3 check from cli to server #4281
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
Changes from 8 commits
a306be8
6d0c53b
eea604a
f036dff
4b41482
8435e85
7bf1f89
36c766e
0e3342b
cfd407d
5e6a638
6ea0a73
d014d8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -303,31 +303,32 @@ func (w *Writer) encode(ctx context.Context) error { | |||||||||||||||||||
| cacheEventPostFlush = cacheEventPostFlush[:0] | ||||||||||||||||||||
| return nil | ||||||||||||||||||||
| } | ||||||||||||||||||||
| select { | ||||||||||||||||||||
| case <-ctx.Done(): | ||||||||||||||||||||
| return ctx.Err() | ||||||||||||||||||||
| case <-ticker.C: | ||||||||||||||||||||
| err := flush() | ||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| case e := <-w.inputCh: | ||||||||||||||||||||
| err := w.write(e) | ||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||
| return err | ||||||||||||||||||||
| } | ||||||||||||||||||||
| num++ | ||||||||||||||||||||
| if num > redo.DefaultFlushBatchSize { | ||||||||||||||||||||
| for { | ||||||||||||||||||||
| select { | ||||||||||||||||||||
| case <-ctx.Done(): | ||||||||||||||||||||
| return ctx.Err() | ||||||||||||||||||||
|
Comment on lines
+308
to
+309
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flush pending callbacks before exiting on context cancellation. Returning immediately on 🔧 Proposed fix- case <-ctx.Done():
- return ctx.Err()
+ case <-ctx.Done():
+ if num > 0 {
+ if err := flush(); err != nil {
+ return errors.Trace(err)
+ }
+ }
+ return ctx.Err()📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| case <-ticker.C: | ||||||||||||||||||||
| err := flush() | ||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| e.PostFlush() | ||||||||||||||||||||
| } else { | ||||||||||||||||||||
| cacheEventPostFlush = append(cacheEventPostFlush, e.PostFlush) | ||||||||||||||||||||
| case e := <-w.inputCh: | ||||||||||||||||||||
| err := w.write(e) | ||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||
| return err | ||||||||||||||||||||
| } | ||||||||||||||||||||
| num++ | ||||||||||||||||||||
| if num >= redo.DefaultFlushBatchSize { | ||||||||||||||||||||
| err := flush() | ||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| e.PostFlush() | ||||||||||||||||||||
| } else { | ||||||||||||||||||||
| cacheEventPostFlush = append(cacheEventPostFlush, e.PostFlush) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| return nil | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| func (w *Writer) close(ctx context.Context) error { | ||||||||||||||||||||
|
|
||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.