mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
Add context propagation to rclone
- Change rclone/fs interfaces to accept context.Context - Update interface implementations to use context.Context - Change top level usage to propagate context to lover level functions Context propagation is needed for stopping transfers and passing other request-scoped values.
This commit is contained in:
committed by
Nick Craig-Wood
parent
a2c317b46e
commit
f78cd1e043
@@ -229,7 +229,7 @@ func New(f fs.Fs, opt *Options) *VFS {
|
||||
// Start polling function
|
||||
if do := vfs.f.Features().ChangeNotify; do != nil {
|
||||
vfs.pollChan = make(chan time.Duration)
|
||||
do(vfs.root.ForgetPath, vfs.pollChan)
|
||||
do(context.TODO(), vfs.root.ForgetPath, vfs.pollChan)
|
||||
vfs.pollChan <- vfs.Opt.PollInterval
|
||||
} else {
|
||||
fs.Infof(f, "poll-interval is not supported by this remote")
|
||||
@@ -480,7 +480,7 @@ func (vfs *VFS) Statfs() (total, used, free int64) {
|
||||
}
|
||||
if vfs.usageTime.IsZero() || time.Since(vfs.usageTime) >= vfs.Opt.DirCacheTime {
|
||||
var err error
|
||||
vfs.usage, err = doAbout()
|
||||
vfs.usage, err = doAbout(context.TODO())
|
||||
vfs.usageTime = time.Now()
|
||||
if err != nil {
|
||||
fs.Errorf(vfs.f, "Statfs failed: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user