Skip to content

Commit

Permalink
Only start backfill loop after ready event
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 25, 2024
1 parent 6e6ef15 commit f9a69ab
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,6 @@ func (user *User) Connect() {
Error: "meta-connect-error",
Message: err.Error(),
})
} else {
go user.BackfillLoop()
}
}

Expand All @@ -411,8 +409,6 @@ func (user *User) Login(ctx context.Context, cookies cookies.Cookies) error {
if err != nil {
user.log.Err(err).Msg("Failed to update user")
return err
} else {
go user.BackfillLoop()
}
return nil
}
Expand Down Expand Up @@ -646,6 +642,7 @@ func (user *User) eventHandler(rawEvt any) {
user.BridgeState.Send(status.BridgeState{StateEvent: status.StateConnected})
user.tryAutomaticDoublePuppeting()
user.handleTable(evt.Table)
go user.BackfillLoop()
case *messagix.Event_SocketError:
user.BridgeState.Send(status.BridgeState{StateEvent: status.StateTransientDisconnect, Message: evt.Err.Error()})
case *messagix.Event_Reconnected:
Expand Down

0 comments on commit f9a69ab

Please sign in to comment.