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 {
|
type ChirpClient struct {
|
||||||
HeartBeat time.Time `json:"heart_beat"`
|
HeartBeat time.Time `json:"heart_beat"`
|
||||||
|
Login string `json:"nickname"`
|
||||||
Active bool
|
Active bool
|
||||||
TGUserID64 int64 `json:"tg_user_id"`
|
TGUserID64 int64 `json:"tg_user_id"`
|
||||||
MQ MQClient `json:"mq_client"`
|
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 {
|
} else if clt, ok := getLockedClient(x.TGUserID64, true); ok {
|
||||||
clt.HeartBeat = x.Date
|
clt.HeartBeat = x.Date
|
||||||
if clt.Active {
|
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()
|
clt.Mux.Unlock()
|
||||||
} else {
|
} else {
|
||||||
log.Printf("MQKeepAliveWorker : Connecting to %s.\n", x.Nickname)
|
clt.Login = x.Nickname
|
||||||
clt.MQ = MQClient{
|
log.Printf("MQKeepAliveWorker : Connecting to %s.\n", clt.Login)
|
||||||
User: cfg.Rabbit.User,
|
clt.MQ.User = cfg.Rabbit.User
|
||||||
Password: cfg.Rabbit.Password,
|
clt.MQ.Password = cfg.Rabbit.Password
|
||||||
Host: cfg.Rabbit.Host,
|
clt.MQ.Host = cfg.Rabbit.Host
|
||||||
Path: x.Queue,
|
clt.MQ.Path = x.Queue
|
||||||
SSL: false,
|
clt.MQ.SSL = false
|
||||||
}
|
|
||||||
clt.MQ.Connection, err = amqp.Dial("amqp://" + clt.MQ.User + ":" + clt.MQ.Password + "@" + clt.MQ.Host + "/" + clt.MQ.Path)
|
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")
|
logOnError(err, "MQKeepAliveWorker : Failed to connect to RabbitMQ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user