mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2: fix more background contexts
This commit is contained in:
parent
9c67d238d7
commit
1038f6a73c
2 changed files with 5 additions and 4 deletions
|
|
@ -302,7 +302,7 @@ func (portal *Portal) queueEvent(ctx context.Context, evt portalEvent) {
|
|||
|
||||
func (portal *Portal) eventLoop() {
|
||||
if cfg := portal.Bridge.Network.GetCapabilities().OutgoingMessageTimeouts; cfg != nil {
|
||||
ctx, cancel := context.WithCancel(portal.Log.WithContext(context.Background()))
|
||||
ctx, cancel := context.WithCancel(portal.Log.WithContext(portal.Bridge.BackgroundCtx))
|
||||
go portal.pendingMessageTimeoutLoop(ctx, cfg)
|
||||
defer cancel()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,8 @@ func (user *User) NewLogin(ctx context.Context, data *database.UserLogin, params
|
|||
}
|
||||
ul.BridgeState = user.Bridge.NewBridgeStateQueue(ul)
|
||||
}
|
||||
err = params.LoadUserLogin(ul.Log.WithContext(context.Background()), ul)
|
||||
noCancelCtx := ul.Log.WithContext(user.Bridge.BackgroundCtx)
|
||||
err = params.LoadUserLogin(noCancelCtx, ul)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if ul.Client == nil {
|
||||
|
|
@ -236,14 +237,14 @@ func (user *User) NewLogin(ctx context.Context, data *database.UserLogin, params
|
|||
return nil, fmt.Errorf("client not filled by LoadUserLogin")
|
||||
}
|
||||
if doInsert {
|
||||
err = user.Bridge.DB.UserLogin.Insert(ctx, ul.UserLogin)
|
||||
err = user.Bridge.DB.UserLogin.Insert(noCancelCtx, ul.UserLogin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user.Bridge.userLoginsByID[ul.ID] = ul
|
||||
user.logins[ul.ID] = ul
|
||||
} else {
|
||||
err = ul.Save(ctx)
|
||||
err = ul.Save(noCancelCtx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue