mirror of
https://github.com/rclone/rclone.git
synced 2025-01-19 04:39:27 +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) {
|
func (p *Newest) newestEntries(entries []upstream.Entry) (upstream.Entry, error) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
mtimes := make([]time.Time, len(entries))
|
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 {
|
for i, e := range entries {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
i, e := i, e // Closure
|
i, e := i, e // Closure
|
||||||
|
@ -307,7 +307,8 @@ func (f *Fs) updateUsageCore(lock bool) error {
|
|||||||
defer f.cacheMutex.Unlock()
|
defer f.cacheMutex.Unlock()
|
||||||
}
|
}
|
||||||
// Run in background, should not be cancelled by user
|
// 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)
|
usage, err := f.Features().About(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user