mirror of
https://github.com/rclone/rclone.git
synced 2025-01-09 15:58:28 +01: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]
|
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
|
// reset the timer which runs the expiries
|
||||||
func (wb *writeBack) _resetTimer() {
|
func (wb *writeBack) _resetTimer() {
|
||||||
wbItem := wb._peekItem()
|
wbItem := wb._peekItem()
|
||||||
if wbItem == nil {
|
if wbItem == nil {
|
||||||
if wb.expiry.IsZero() {
|
wb._stopTimer()
|
||||||
return
|
|
||||||
}
|
|
||||||
wb.expiry = time.Time{}
|
|
||||||
fs.Debugf(nil, "resetTimer STOP")
|
|
||||||
if wb.timer != nil {
|
|
||||||
wb.timer.Stop()
|
|
||||||
wb.timer = nil
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if wb.expiry.Equal(wbItem.expiry) {
|
if wb.expiry.Equal(wbItem.expiry) {
|
||||||
return
|
return
|
||||||
@ -377,6 +382,8 @@ func (wb *writeBack) processItems(ctx context.Context) {
|
|||||||
|
|
||||||
if resetTimer {
|
if resetTimer {
|
||||||
wb._resetTimer()
|
wb._resetTimer()
|
||||||
|
} else {
|
||||||
|
wb._stopTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user