Merge branch 'master' of http://474420502.top/eson/crontabex
This commit is contained in:
commit
f83fd9f635
13
crontab.go
13
crontab.go
|
@ -9,6 +9,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/satori/go.uuid"
|
||||||
|
|
||||||
"474420502.top/eson/structure/circular_linked"
|
"474420502.top/eson/structure/circular_linked"
|
||||||
"github.com/Pallinder/go-randomdata"
|
"github.com/Pallinder/go-randomdata"
|
||||||
|
|
||||||
|
@ -42,6 +44,7 @@ func (force *Force) NextTime() time.Time {
|
||||||
type Crontab struct {
|
type Crontab struct {
|
||||||
crontab string
|
crontab string
|
||||||
|
|
||||||
|
uid uuid.UUID
|
||||||
force *Force
|
force *Force
|
||||||
|
|
||||||
min []timePointer
|
min []timePointer
|
||||||
|
@ -166,6 +169,12 @@ func (cron *Crontab) String() string {
|
||||||
func (cron *Crontab) FromString(crontab string) error {
|
func (cron *Crontab) FromString(crontab string) error {
|
||||||
crontab = cron.crontab
|
crontab = cron.crontab
|
||||||
|
|
||||||
|
uid, err := uuid.NewV4()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
cron.uid = uid
|
||||||
|
|
||||||
cron.interval = nil
|
cron.interval = nil
|
||||||
cron.min = nil
|
cron.min = nil
|
||||||
cron.hour = nil
|
cron.hour = nil
|
||||||
|
@ -297,7 +306,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("success:", cron.trueCount, "count time wait:", isecond, "s")
|
fmt.Println(time.Now().Format("01-02 15:04:05"), cron.uid.String(), "success:", cron.trueCount, " wait:", isecond)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -315,7 +324,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("fail:", cron.failCount, "count time wait:", isecond, "s")
|
fmt.Println(time.Now().Format("01-02 15:04:05"), cron.uid.String(), "fail:", cron.failCount, " wait:", isecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
iv.Count--
|
iv.Count--
|
||||||
|
|
Loading…
Reference in New Issue
Block a user