Compare commits

...

1 Commits

Author SHA1 Message Date
Urko. 1303d540cb fix: copy file with long long running ctx 2024-01-01 15:01:51 +01:00
1 changed files with 5 additions and 1 deletions

View File

@ -34,9 +34,13 @@ func (b *BackBlaze) Sync(ctx context.Context) error {
b.logger.Infoln("bucket found:", bc.Name())
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)
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 nil