This commit is contained in:
aozhiwei 2024-06-22 21:15:33 +08:00
parent 595ce037a7
commit ce3aea1602

View File

@ -1,7 +1,7 @@
package task package task
import ( import (
"q5" //"q5"
"f5" "f5"
"time" "time"
"fmt" "fmt"
@ -20,37 +20,29 @@ func (this* specTransfer721) unInit() {
} }
func (this* specTransfer721) process() { func (this* specTransfer721) process() {
var lastIdx int64 f5.GetGoStyleDb().LoopLoad(
for true {
hasNextData := false
sql := fmt.Sprintf(`
SELECT * FROM t_721nft_spec_transfer WHERE idx > %d LIMIT 1000`,
lastIdx,
)
f5.GetGoStyleDb().RawQuery(
constant.BCEVENT_DB, constant.BCEVENT_DB,
sql, func (lastIdx int64) string {
nowTime := f5.GetApp().GetRealSeconds()
expiredTime := nowTime - 3600 * 24 * 7
sql := fmt.Sprintf(`
SELECT * FROM t_721nft_spec_transfer WHERE idx > %d AND status = 0 AND createtime < %d LIMIT 1000
`,
lastIdx,
expiredTime)
return sql
},
[]string{ []string{
}, },
func (err error, ds *f5.DataSet) { func () time.Duration {
if err == nil { return time.Second * 10
for ds.Next() { },
idx := q5.ToInt64(ds.GetByName("idx")) func () time.Duration {
if idx > lastIdx { return time.Second * 60 * 1
lastIdx = idx },
} this.process1)
hasNextData = true
}
}
})
if hasNextData {
time.Sleep(time.Second * 5)
} else {
lastIdx = 0
time.Sleep(time.Second * 60 * 1)
}
}
} }
func (this* specTransfer721) process1(ds *f5.DataSet) { func (this* specTransfer721) process1(ds *f5.DataSet) bool {
return true
} }