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