mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2: fix initializing background context
This commit is contained in:
parent
27769dfc98
commit
376fa1f368
1 changed files with 3 additions and 4 deletions
|
|
@ -111,10 +111,6 @@ func (e DBUpgradeError) Unwrap() error {
|
|||
}
|
||||
|
||||
func (br *Bridge) Start(ctx context.Context) error {
|
||||
if br.backgroundCtx == nil || br.backgroundCtx.Err() != nil {
|
||||
// Ensure we have a valid event handling context
|
||||
br.backgroundCtx, br.cancelBackgroundCtx = context.WithCancel(context.Background())
|
||||
}
|
||||
ctx = br.Log.WithContext(ctx)
|
||||
err := br.StartConnectors(ctx)
|
||||
if err != nil {
|
||||
|
|
@ -174,6 +170,9 @@ 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.ExternallyManagedDB {
|
||||
err := br.DB.Upgrade(ctx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue