update
This commit is contained in:
@@ -2,6 +2,7 @@ package qinglong
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cdle/sillyGirl/core"
|
"github.com/cdle/sillyGirl/core"
|
||||||
@@ -22,19 +23,13 @@ func init() {
|
|||||||
if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.Value))); err != nil {
|
if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.Value))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
i := 0
|
|
||||||
for {
|
for {
|
||||||
i++
|
time.Sleep(time.Microsecond * 300)
|
||||||
time.Sleep(time.Second)
|
|
||||||
data, _ := GetCronLog(cron.Value)
|
data, _ := GetCronLog(cron.Value)
|
||||||
if data != "" {
|
if strings.Contains(data, "执行结束...") {
|
||||||
s.Reply(data)
|
s.Reply(data)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if i > 5 {
|
|
||||||
s.Reply("执行异常。")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if err := Config.Req(cron, CRONS, DELETE, []byte(`["`+cron.Value+`"]`)); err != nil {
|
if err := Config.Req(cron, CRONS, DELETE, []byte(`["`+cron.Value+`"]`)); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -55,19 +50,13 @@ func init() {
|
|||||||
if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.Value))); err != nil {
|
if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.Value))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
i := 0
|
|
||||||
for {
|
for {
|
||||||
i++
|
time.Sleep(time.Microsecond * 300)
|
||||||
time.Sleep(time.Second)
|
|
||||||
data, _ := GetCronLog(cron.Value)
|
data, _ := GetCronLog(cron.Value)
|
||||||
if data != "" {
|
if strings.Contains(data, "执行结束...") {
|
||||||
s.Reply(data)
|
s.Reply(data)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if i > 5 {
|
|
||||||
s.Reply("执行异常。")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if err := Config.Req(cron, CRONS, DELETE, []byte(`["`+cron.Value+`"]`)); err != nil {
|
if err := Config.Req(cron, CRONS, DELETE, []byte(`["`+cron.Value+`"]`)); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user