mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-31 18:53:10 -06:00
Try to drain the channel, if possible
This commit is contained in:
parent
55951e2d72
commit
8b6d3cb35f
|
|
@ -117,8 +117,12 @@ func (d *sessionsDict) deleteSession(sessionID string) {
|
|||
delete(d.sessions, sessionID)
|
||||
// stop the timer, e.g. because the registration was completed
|
||||
if t, ok := d.timer[sessionID]; ok {
|
||||
// trying to drain the channel results in a deadlock?
|
||||
t.Stop()
|
||||
if !t.Stop() {
|
||||
select {
|
||||
case <-t.C:
|
||||
default:
|
||||
}
|
||||
}
|
||||
delete(d.timer, sessionID)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue