mirror of
https://github.com/rclone/rclone.git
synced 2025-01-18 20:31:00 +01:00
union: add cancel to ctx
This commit is contained in:
parent
998169fc02
commit
3cd1b20236
@ -52,7 +52,8 @@ func (p *Newest) newest(ctx context.Context, upstreams []*upstream.Fs, path stri
|
||||
func (p *Newest) newestEntries(entries []upstream.Entry) (upstream.Entry, error) {
|
||||
var wg sync.WaitGroup
|
||||
mtimes := make([]time.Time, len(entries))
|
||||
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
for i, e := range entries {
|
||||
wg.Add(1)
|
||||
i, e := i, e // Closure
|
||||
|
@ -307,7 +307,8 @@ func (f *Fs) updateUsageCore(lock bool) error {
|
||||
defer f.cacheMutex.Unlock()
|
||||
}
|
||||
// Run in background, should not be cancelled by user
|
||||
ctx, _ := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
usage, err := f.Features().About(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user