Commit 1fd4fb38 authored by vicotor's avatar vicotor

update for twitter swarm

parent 6655d06a
......@@ -148,18 +148,19 @@ func CheckTaskExist(userId, taskId, taskType string) (bool, error) {
func CheckFollowerTaskAndAccountCount() (bool, error) {
// check follower task count need < available account count.
fc, err := FollowerTaskCount()
if err != nil {
return false, err
}
ac, err := AvailableAccountCount()
if err != nil {
return false, err
}
return fc < ac, nil
return true, nil
//fc, err := FollowerTaskCount()
//if err != nil {
// return false, err
//}
//
//ac, err := AvailableAccountCount()
//
//if err != nil {
// return false, err
//}
//
//return fc < ac, nil
}
func FollowerTaskCount() (int64, error) {
......
......@@ -16,9 +16,12 @@ package main
import (
"code.wuban.net.cn/odysseus/twitter_syncer/acmanager"
"code.wuban.net.cn/odysseus/twitter_syncer/swarm"
"flag"
"fmt"
"github.com/gofiber/swagger"
"log/slog"
"strings"
//"github.com/gofiber/contrib/swagger"
"github.com/gofiber/fiber/v2"
......@@ -27,7 +30,14 @@ import (
_ "code.wuban.net.cn/odysseus/twitter_syncer/docs"
)
var (
beeFlag = flag.String("bee", "", "initial bees to use fetch follower")
)
func main() {
flag.Parse()
bees := strings.Split(*beeFlag, ",")
swarm.InitSwarm(bees)
done := make(chan interface{})
......
......@@ -87,8 +87,6 @@ func (w *Work) RunJob(t TaskJob) chan<- interface{} {
fiveMinutesTicker := time.NewTicker(time.Minute * 1)
halfHourTicker := time.NewTicker(time.Minute * 30)
//recordFc := make(map[string]int)
recordFc := make([]TimeAndFollowCount, 0, 100)
for {
......
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