()
| 83 | } |
| 84 | |
| 85 | func GetNextWorker() *Worker { |
| 86 | Workers.mut.Lock() |
| 87 | defer Workers.mut.Unlock() |
| 88 | index := (Workers.index + 1) % len(Workers.Bots) |
| 89 | Workers.index = index |
| 90 | worker := Workers.Bots[index] |
| 91 | Workers.log.Sugar().Debugf("Using worker %d", worker.ID) |
| 92 | return worker |
| 93 | } |
| 94 | |
| 95 | func StartWorkers(log *zap.Logger) (*BotWorkers, error) { |
| 96 | Workers.Init(log) |