mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:46:24 +08:00
vfs: writeback - stop the timer explicitly on transfers exceeded
This commit is contained in:
parent
8506066926
commit
b9ff495483
|
@ -187,19 +187,24 @@ func (wb *writeBack) _peekItem() (wbItem *writeBackItem) {
|
|||
return wb.items[0]
|
||||
}
|
||||
|
||||
// stop the timer which runs the expiries
|
||||
func (wb *writeBack) _stopTimer() {
|
||||
if wb.expiry.IsZero() {
|
||||
return
|
||||
}
|
||||
wb.expiry = time.Time{}
|
||||
fs.Debugf(nil, "resetTimer STOP")
|
||||
if wb.timer != nil {
|
||||
wb.timer.Stop()
|
||||
wb.timer = nil
|
||||
}
|
||||
}
|
||||
|
||||
// reset the timer which runs the expiries
|
||||
func (wb *writeBack) _resetTimer() {
|
||||
wbItem := wb._peekItem()
|
||||
if wbItem == nil {
|
||||
if wb.expiry.IsZero() {
|
||||
return
|
||||
}
|
||||
wb.expiry = time.Time{}
|
||||
fs.Debugf(nil, "resetTimer STOP")
|
||||
if wb.timer != nil {
|
||||
wb.timer.Stop()
|
||||
wb.timer = nil
|
||||
}
|
||||
wb._stopTimer()
|
||||
} else {
|
||||
if wb.expiry.Equal(wbItem.expiry) {
|
||||
return
|
||||
|
@ -377,6 +382,8 @@ func (wb *writeBack) processItems(ctx context.Context) {
|
|||
|
||||
if resetTimer {
|
||||
wb._resetTimer()
|
||||
} else {
|
||||
wb._stopTimer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user