From 2f498db6520eb150f39a8694c44a1684e9087eb6 Mon Sep 17 00:00:00 2001 From: "i.navrotskyj" Date: Tue, 26 Mar 2024 17:13:17 +0200 Subject: [PATCH] DEV-3973 --- queue/dialing.go | 4 ++++ store/sqlstore/member_store.go | 16 ++++++++++++++++ store/store.go | 1 + 3 files changed, 21 insertions(+) diff --git a/queue/dialing.go b/queue/dialing.go index 6b767fb3..6ebbb03b 100644 --- a/queue/dialing.go +++ b/queue/dialing.go @@ -122,6 +122,10 @@ func (d *DialingImpl) routeIdleAgents() { } else { d.queueManager.TimeoutLeavingMember(a) } + } else { + // TODO + d.queueManager.store.Member().SetTimeoutError(v.AttemptId) + wlog.Error("attempt[%d] error: not found in cache, set timeout error") } } } else { diff --git a/store/sqlstore/member_store.go b/store/sqlstore/member_store.go index 9bd72bf9..d6f56f1f 100644 --- a/store/sqlstore/member_store.go +++ b/store/sqlstore/member_store.go @@ -599,6 +599,22 @@ where a.timeout < now() and a.node_id = :NodeId and not a.schema_processing is t return attempts, nil } +func (s *SqlMemberStore) SetTimeoutError(id int64) *model.AppError { + _, err := s.GetMaster().Exec(`update call_center.cc_member_attempt +set schema_processing = false, + result = 'timeout error' +where id = :Id;`, map[string]interface{}{ + "Id": id, + }) + + if err != nil { + return model.NewAppError("SqlMemberStore.SetTimeoutError", "store.sql_member.set_timeouts.app_error", nil, + err.Error(), http.StatusInternalServerError) + } + + return nil +} + func (s *SqlMemberStore) CallbackReporting(attemptId int64, callback *model.AttemptCallback, maxAttempts uint, waitBetween uint64, perNum bool) (*model.AttemptReportingResult, *model.AppError) { var result *model.AttemptReportingResult err := s.GetMaster().SelectOne(&result, `select * diff --git a/store/store.go b/store/store.go index fee033a6..cf9446e3 100644 --- a/store/store.go +++ b/store/store.go @@ -78,6 +78,7 @@ type MemberStore interface { SaveToHistory() ([]*model.HistoryAttempt, *model.AppError) GetTimeouts(nodeId string) ([]*model.AttemptReportingTimeout, *model.AppError) + SetTimeoutError(id int64) *model.AppError RenewalProcessing(domainId, attId int64, renewalSec uint32) (*model.RenewalProcessing, *model.AppError) // CHAT TODO