1
This commit is contained in:
parent
595ce037a7
commit
ce3aea1602
@ -1,7 +1,7 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"q5"
|
||||
//"q5"
|
||||
"f5"
|
||||
"time"
|
||||
"fmt"
|
||||
@ -20,37 +20,29 @@ func (this* specTransfer721) unInit() {
|
||||
}
|
||||
|
||||
func (this* specTransfer721) process() {
|
||||
var lastIdx int64
|
||||
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,
|
||||
sql,
|
||||
[]string{
|
||||
},
|
||||
func (err error, ds *f5.DataSet) {
|
||||
if err == nil {
|
||||
for ds.Next() {
|
||||
idx := q5.ToInt64(ds.GetByName("idx"))
|
||||
if idx > lastIdx {
|
||||
lastIdx = idx
|
||||
}
|
||||
hasNextData = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if hasNextData {
|
||||
time.Sleep(time.Second * 5)
|
||||
} else {
|
||||
lastIdx = 0
|
||||
time.Sleep(time.Second * 60 * 1)
|
||||
}
|
||||
}
|
||||
f5.GetGoStyleDb().LoopLoad(
|
||||
constant.BCEVENT_DB,
|
||||
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{
|
||||
},
|
||||
func () time.Duration {
|
||||
return time.Second * 10
|
||||
},
|
||||
func () time.Duration {
|
||||
return time.Second * 60 * 1
|
||||
},
|
||||
this.process1)
|
||||
}
|
||||
|
||||
func (this* specTransfer721) process1(ds *f5.DataSet) {
|
||||
func (this* specTransfer721) process1(ds *f5.DataSet) bool {
|
||||
return true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user