mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/userlogin: add blocking cleanup delete option
Some checks failed
Some checks failed
This allows the caller to block until the cleanup actions are complete.
This commit is contained in:
parent
4b970e0ea7
commit
b32def2b14
1 changed files with 11 additions and 2 deletions
|
|
@ -255,6 +255,7 @@ func (ul *UserLogin) Logout(ctx context.Context) {
|
|||
type DeleteOpts struct {
|
||||
LogoutRemote bool
|
||||
DontCleanupRooms bool
|
||||
BlockingCleanup bool
|
||||
unlocked bool
|
||||
}
|
||||
|
||||
|
|
@ -295,9 +296,17 @@ func (ul *UserLogin) Delete(ctx context.Context, state status.BridgeState, opts
|
|||
ul.Bridge.cacheLock.Unlock()
|
||||
}
|
||||
backgroundCtx := context.WithoutCancel(ctx)
|
||||
go ul.deleteSpace(backgroundCtx)
|
||||
if !opts.BlockingCleanup {
|
||||
go ul.deleteSpace(backgroundCtx)
|
||||
} else {
|
||||
ul.deleteSpace(backgroundCtx)
|
||||
}
|
||||
if portals != nil {
|
||||
go ul.kickUserFromPortals(backgroundCtx, portals, state.StateEvent == status.StateBadCredentials, false)
|
||||
if !opts.BlockingCleanup {
|
||||
go ul.kickUserFromPortals(backgroundCtx, portals, state.StateEvent == status.StateBadCredentials, false)
|
||||
} else {
|
||||
ul.kickUserFromPortals(backgroundCtx, portals, state.StateEvent == status.StateBadCredentials, false)
|
||||
}
|
||||
}
|
||||
if state.StateEvent != "" {
|
||||
ul.BridgeState.Send(state)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue