Commit 3fb16bbc authored by vicotor's avatar vicotor

update for syncer

parent 2c242dfa
......@@ -159,7 +159,7 @@ func GetTasks() ([]TaskJob, error) {
Ascending: false,
// NullsFirst bool
// ForeignTable string
}).Range(0, 10, "").Execute()
}).Range(0, 100, "").Execute()
if err != nil {
slog.Error("select * from followers error", err)
......
......@@ -4,6 +4,7 @@ import (
"code.wuban.net.cn/odysseus/twitter_syncer/swarm"
"fmt"
"log/slog"
"math/rand"
"sync"
"time"
)
......@@ -82,10 +83,12 @@ func (w *Work) RunJob(t TaskJob) chan<- interface{} {
if t.TaskType == FollowType {
cli := swarm.GetSwarm()
randomIdx := rand.Intn(10) + 1
randomDelay := time.Duration(randomIdx) * time.Second
secondTicker := time.NewTicker(time.Second * 20)
fiveMinutesTicker := time.NewTicker(time.Minute * 1)
halfHourTicker := time.NewTicker(time.Minute * 30)
secondTicker := time.NewTicker(time.Second*20 + randomDelay)
fiveMinutesTicker := time.NewTicker(time.Minute*1 + randomDelay)
halfHourTicker := time.NewTicker(time.Minute*30 + randomDelay)
first := true
recordFc := make([]TimeAndFollowCount, 0, 100)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment