Feat: cancel upload session in slave node
This commit is contained in:
@@ -18,7 +18,7 @@ type ConstantBackoff struct {
|
||||
|
||||
func (c *ConstantBackoff) Next() bool {
|
||||
c.tried++
|
||||
if c.tried >= c.Max {
|
||||
if c.tried > c.Max {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ func (c *ChunkGroup) Process(processor ChunkProcessFunc) error {
|
||||
err := processor(c, io.LimitReader(c.file, int64(c.chunkSize)))
|
||||
if err != nil {
|
||||
if err != context.Canceled && c.file.Seekable() && c.backoff.Next() {
|
||||
if _, seekErr := c.file.Seek(c.Start(), io.SeekStart); err != nil {
|
||||
if _, seekErr := c.file.Seek(c.Start(), io.SeekStart); seekErr != nil {
|
||||
return fmt.Errorf("failed to seek back to chunk start: %w, last error: %w", seekErr, err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user