Skip to content

Commit

Permalink
WTEL-4748
Browse files Browse the repository at this point in the history
  • Loading branch information
i.navrotskyj committed Jul 10, 2024
1 parent 4f3acbc commit a8827f3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
16 changes: 16 additions & 0 deletions queue/attempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type Attempt struct {
processingFields sync.Map
processingFormStarted bool
bridgedAt int64
transferredAt int64 // todo work in chat
manualDistribution bool
}

Expand Down Expand Up @@ -152,6 +153,21 @@ func (a *Attempt) MarkProcessingFormStarted() {
a.Unlock()
}

func (a *Attempt) MarkTransferred() {
a.Lock()
if a.transferredAt == 0 {
a.transferredAt = model.GetMillis()
}
a.Unlock()
}

func (a *Attempt) TransferredAt() int64 {
a.RLock()
t := a.transferredAt
a.RUnlock()
return t
}

func (a *Attempt) ProcessingFormStarted() bool {
a.RLock()
defer a.RUnlock()
Expand Down
8 changes: 6 additions & 2 deletions queue/chat_inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,15 @@ func (queue *InboundChatQueue) process(attempt *Attempt, inviterId, invUserId st
// TODO: what reason is this?
aSess.Close("")
}
transferredProcessing := conv.Cause() == "transfer" &&
transferred := conv.Cause() == "transfer"
if transferred {
attempt.MarkTransferred()
}
transferredProcessing := transferred &&
queue.GetVariable(transferResult) == model.MEMBER_CAUSE_ABANDONED

if conv.BridgedAt() > 0 && !transferredProcessing {
team.Reporting(queue, attempt, agent, conv.ReportingAt() > 0, false)
team.Reporting(queue, attempt, agent, conv.ReportingAt() > 0, conv.Cause() == "transfer")
} else {
team.Missed(attempt, agent)
queue.queueManager.LeavingMember(attempt)
Expand Down
2 changes: 1 addition & 1 deletion queue/queue_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ func (queueManager *QueueManager) closeBeforeReporting(attemptId int64, res *mod
break
case model.QueueChannelChat:
var conv *chat.Conversation
if a != nil {
if a != nil && a.TransferredAt() == 0 {
if conv, err = queueManager.GetChat(a.memberChannel.Id()); err == nil {
err = conv.Reporting(false)
}
Expand Down

0 comments on commit a8827f3

Please sign in to comment.