bridgev2: expose background context
Some checks failed
Go / Lint (latest) (push) Has been cancelled
Go / Build (old, libolm) (push) Has been cancelled
Go / Build (latest, libolm) (push) Has been cancelled
Go / Build (old, goolm) (push) Has been cancelled
Go / Build (latest, goolm) (push) Has been cancelled

This commit is contained in:
Tulir Asokan 2025-05-09 15:16:14 +03:00
commit a0191c8f58
2 changed files with 4 additions and 4 deletions

View file

@ -55,7 +55,7 @@ type Bridge struct {
wakeupBackfillQueue chan struct{}
stopBackfillQueue *exsync.Event
backgroundCtx context.Context
BackgroundCtx context.Context
cancelBackgroundCtx context.CancelFunc
}
@ -170,8 +170,8 @@ func (br *Bridge) RunOnce(ctx context.Context, loginID networkid.UserLoginID, pa
func (br *Bridge) StartConnectors(ctx context.Context) error {
br.Log.Info().Msg("Starting bridge")
if br.backgroundCtx == nil || br.backgroundCtx.Err() != nil {
br.backgroundCtx, br.cancelBackgroundCtx = context.WithCancel(context.Background())
if br.BackgroundCtx == nil || br.BackgroundCtx.Err() != nil {
br.BackgroundCtx, br.cancelBackgroundCtx = context.WithCancel(context.Background())
}
if !br.ExternallyManagedDB {

View file

@ -375,7 +375,7 @@ func (portal *Portal) getEventCtxWithLog(rawEvt any, idx int) context.Context {
case *portalCreateEvent:
return evt.ctx
}
return logWith.Logger().WithContext(portal.Bridge.backgroundCtx)
return logWith.Logger().WithContext(portal.Bridge.BackgroundCtx)
}
func (portal *Portal) handleSingleEvent(ctx context.Context, rawEvt any, doneCallback func()) {