fix: copy file with long long running ctx
This commit is contained in:
parent
98bab81f3c
commit
1303d540cb
|
@ -34,9 +34,13 @@ func (b *BackBlaze) Sync(ctx context.Context) error {
|
||||||
|
|
||||||
b.logger.Infoln("bucket found:", bc.Name())
|
b.logger.Infoln("bucket found:", bc.Name())
|
||||||
if b.options.FilePath != "" {
|
if b.options.FilePath != "" {
|
||||||
|
// Create a separate context for long-running operations
|
||||||
|
longRunningCtx, cancelLongRunningOps := context.WithCancel(context.Background())
|
||||||
|
defer cancelLongRunningOps()
|
||||||
|
|
||||||
b.logger.Infoln("file:", b.options.FilePath)
|
b.logger.Infoln("file:", b.options.FilePath)
|
||||||
|
|
||||||
if err := b.copyFile(ctx, bc, b.options.FilePath); err != nil {
|
if err := b.copyFile(longRunningCtx, bc, b.options.FilePath); err != nil {
|
||||||
return fmt.Errorf("copyFile %w", err)
|
return fmt.Errorf("copyFile %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue