mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/portal: don't process any more events if portal is deleted
This commit is contained in:
parent
a9ff1443f7
commit
d5c6393f23
1 changed files with 6 additions and 1 deletions
|
|
@ -90,7 +90,8 @@ type Portal struct {
|
|||
functionalMembersLock sync.Mutex
|
||||
functionalMembersCache *event.ElementFunctionalMembersContent
|
||||
|
||||
events chan portalEvent
|
||||
events chan portalEvent
|
||||
deleted bool
|
||||
|
||||
eventsLock sync.Mutex
|
||||
eventIdx int
|
||||
|
|
@ -335,6 +336,9 @@ func (portal *Portal) eventLoop() {
|
|||
}
|
||||
i := 0
|
||||
for rawEvt := range portal.events {
|
||||
if portal.deleted {
|
||||
return
|
||||
}
|
||||
i++
|
||||
if portal.Bridge.Config.AsyncEvents {
|
||||
go portal.handleSingleEventWithDelayLogging(i, rawEvt)
|
||||
|
|
@ -4811,6 +4815,7 @@ func (portal *Portal) unlockedDeleteCache() {
|
|||
// TODO there's a small risk of this racing with a queueEvent call
|
||||
close(portal.events)
|
||||
}
|
||||
portal.deleted = true
|
||||
}
|
||||
|
||||
func (portal *Portal) Save(ctx context.Context) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue