debug client revamping
This commit is contained in:
parent
3e3a1ca376
commit
1102fd47a5
1
def.go
1
def.go
@ -26,6 +26,7 @@ type MQClient struct {
|
||||
|
||||
type ChirpClient struct {
|
||||
HeartBeat time.Time `json:"heart_beat"`
|
||||
Login string `json:"nickname"`
|
||||
Active bool
|
||||
TGUserID64 int64 `json:"tg_user_id"`
|
||||
MQ MQClient `json:"mq_client"`
|
||||
|
17
workers.go
17
workers.go
@ -166,17 +166,16 @@ func MQKeepAliveWorker() {
|
||||
} else if clt, ok := getLockedClient(x.TGUserID64, true); ok {
|
||||
clt.HeartBeat = x.Date
|
||||
if clt.Active {
|
||||
log.Printf("MQKeepAliveWorker : Client %s already active.\n", x.Nickname)
|
||||
log.Printf("MQKeepAliveWorker : Client %s already active.\n", clt.Login)
|
||||
clt.Mux.Unlock()
|
||||
} else {
|
||||
log.Printf("MQKeepAliveWorker : Connecting to %s.\n", x.Nickname)
|
||||
clt.MQ = MQClient{
|
||||
User: cfg.Rabbit.User,
|
||||
Password: cfg.Rabbit.Password,
|
||||
Host: cfg.Rabbit.Host,
|
||||
Path: x.Queue,
|
||||
SSL: false,
|
||||
}
|
||||
clt.Login = x.Nickname
|
||||
log.Printf("MQKeepAliveWorker : Connecting to %s.\n", clt.Login)
|
||||
clt.MQ.User = cfg.Rabbit.User
|
||||
clt.MQ.Password = cfg.Rabbit.Password
|
||||
clt.MQ.Host = cfg.Rabbit.Host
|
||||
clt.MQ.Path = x.Queue
|
||||
clt.MQ.SSL = false
|
||||
clt.MQ.Connection, err = amqp.Dial("amqp://" + clt.MQ.User + ":" + clt.MQ.Password + "@" + clt.MQ.Host + "/" + clt.MQ.Path)
|
||||
logOnError(err, "MQKeepAliveWorker : Failed to connect to RabbitMQ")
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user