mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
* rc/jobs: Add SetInitialJobID function that allows for setting the jobID
This commit is contained in:
parent
82c6c77e07
commit
5d6593de4f
|
@ -10,12 +10,10 @@ import (
|
|||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/fs/rc"
|
||||
|
||||
"github.com/rclone/rclone/fs/accounting"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/accounting"
|
||||
"github.com/rclone/rclone/fs/rc"
|
||||
)
|
||||
|
||||
// Job describes a asynchronous task started via the rc package
|
||||
|
@ -59,6 +57,13 @@ func SetOpt(opt *rc.Options) {
|
|||
running.opt = opt
|
||||
}
|
||||
|
||||
// SetInitialJobID allows for setting jobID before starting any jobs.
|
||||
func SetInitialJobID(id int64) {
|
||||
if !atomic.CompareAndSwapInt64(&jobID, 0, id) {
|
||||
panic("Setting jobID is only possible before starting any jobs")
|
||||
}
|
||||
}
|
||||
|
||||
// kickExpire makes sure Expire is running
|
||||
func (jobs *Jobs) kickExpire() {
|
||||
jobs.mu.Lock()
|
||||
|
|
Loading…
Reference in New Issue
Block a user