diff --git a/job.go b/job.go index 8081e6a..631f8ad 100644 --- a/job.go +++ b/job.go @@ -2102,6 +2102,7 @@ func jobGetStash(j Job) { j.Trigger = 0 } else if rule.MsgTypeID64 == cacheObjSubType[`msg_busy`] { p.CleanupMsg = append(p.CleanupMsg, *m) + j.Trigger = 0 } } } @@ -2120,13 +2121,14 @@ func jobGetStash(j Job) { userID64 = clt.TGUserID64 busyUntil = clt.CWBusyUntil } + clt.Mux.Unlock() } } setJobCallback(j.ID64, userID64, cacheObjSubType[`msg_exchange_req`]) setJobCallback(j.ID64, userID64, cacheObjSubType[`msg_exchange_ack`]) setJobCallback(j.ID64, userID64, cacheObjSubType[`msg_busy`]) rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) - clientSendCWMsgDelay(userID64, "⚖Exchange", time.Now().UTC().Add(-2*time.Second).Sub(busyUntil)) + clientSendCWMsgDelay(userID64, "⚖Exchange", busyUntil.Add(2*time.Second).Sub(time.Now().UTC())) } if len(p.ClientID64) == 0 && j.Trigger == 0 { @@ -2135,6 +2137,15 @@ func jobGetStash(j Job) { } } + c := TGCommand{ + Type: commandReplyMsg, + Text: "Done.", + FromMsgID64: p.MsgID64, + FromChatID64: p.ChatID64, + ParseMode: cmdParseModeHTML, + } + TGCmdQueue <- c + err = setJobDone(j.ID64) logOnError(err, "jobGetStash : setJobDone")