Skip to content

Commit

Permalink
[Cherry-pick] fix delete nil routine (#14951) (#15026)
Browse files Browse the repository at this point in the history
Fix: delete nil routine

Approved by: @daviszhen, @sukki37
  • Loading branch information
ck89119 committed Mar 19, 2024
1 parent bd6febf commit 4c6cae1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/frontend/routine_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,15 @@ func (rm *RoutineManager) deleteRoutine(rs goetty.IOSession) *Routine {
var ok bool
rm.mu.Lock()
defer rm.mu.Unlock()
rt, ok = rm.clients[rs]
if ok {
if rt, ok = rm.clients[rs]; ok {
delete(rm.clients, rs)
}
connID := rt.getConnectionID()
_, ok = rm.routinesByConnID[connID]
if ok {
delete(rm.routinesByConnID, connID)

if rt != nil {
connID := rt.getConnectionID()
if _, ok = rm.routinesByConnID[connID]; ok {
delete(rm.routinesByConnID, connID)
}
}
return rt
}
Expand Down

0 comments on commit 4c6cae1

Please sign in to comment.