mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03: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)
|
delete(d.sessions, sessionID)
|
||||||
// stop the timer, e.g. because the registration was completed
|
// stop the timer, e.g. because the registration was completed
|
||||||
if t, ok := d.timer[sessionID]; ok {
|
if t, ok := d.timer[sessionID]; ok {
|
||||||
// trying to drain the channel results in a deadlock?
|
if !t.Stop() {
|
||||||
t.Stop()
|
select {
|
||||||
|
case <-t.C:
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
delete(d.timer, sessionID)
|
delete(d.timer, sessionID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue