mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-24 02:26:39 +08:00
- climc: 设置 option 没有 subcommand 的情况下进入交互模式, 代码逻辑变清晰
- make fmt
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
package cronman
|
||||
|
||||
import (
|
||||
"time"
|
||||
"runtime/debug"
|
||||
"context"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
"reflect"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
DEFAULT_CRON_INTERVAL = 60*time.Second // default resolution is 1 monutes
|
||||
DEFAULT_CRON_INTERVAL = 60 * time.Second // default resolution is 1 monutes
|
||||
)
|
||||
|
||||
type SCronJobManager struct {
|
||||
checkInterval time.Duration
|
||||
timer *time.Timer
|
||||
jobs []SCronJob
|
||||
timer *time.Timer
|
||||
jobs []SCronJob
|
||||
}
|
||||
|
||||
type SCronJob struct {
|
||||
name string
|
||||
name string
|
||||
runInterval time.Duration
|
||||
job func(ctx context.Context, userCred mcclient.TokenCredential)
|
||||
lastRun time.Time
|
||||
job func(ctx context.Context, userCred mcclient.TokenCredential)
|
||||
lastRun time.Time
|
||||
}
|
||||
|
||||
func NewCronJobManager(interval time.Duration) *SCronJobManager {
|
||||
@@ -92,4 +92,3 @@ func runJob(name string, job func(ctx context.Context, userCred mcclient.TokenCr
|
||||
userCred := auth.AdminCredential()
|
||||
job(ctx, userCred)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package taskman
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user