add uid print

This commit is contained in:
eson 2019-01-02 01:59:34 +08:00
parent 7342ef6605
commit d148ea2445

View File

@ -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
@ -295,7 +304,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) {
} }
log.Println("success:", cron.trueCount, "count time wait:", isecond, "s") fmt.Println(cron.uid.String(), "success:", cron.trueCount, " wait:", isecond)
} else { } else {
@ -313,7 +322,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) {
} }
} }
log.Println("fail:", cron.failCount, "count time wait:", isecond, "s") fmt.Println(cron.uid.String(), "fail:", cron.failCount, " wait:", isecond)
} }
iv.Count-- iv.Count--