Skip to content

Commit

Permalink
Merge pull request #35 from twouters/bugfix/34
Browse files Browse the repository at this point in the history
Only initiate backfill when it's enabled
  • Loading branch information
tulir authored Sep 25, 2023
2 parents 466ff24 + ab9c844 commit 4530ff3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,17 @@ func (user *User) slackMessageHandler(userTeam *database.UserTeam) {
userTeam.Upsert()

user.tryAutomaticDoublePuppeting(userTeam)
user.BridgeStates[userTeam.Key.TeamID].Send(status.BridgeState{StateEvent: status.StateBackfilling})

user.log.Infofln("connected to team %s as %s", userTeam.TeamName, userTeam.SlackEmail)

portals := user.bridge.dbPortalsToPortals(user.bridge.DB.Portal.GetAllForUserTeam(userTeam.Key))
for _, portal := range portals {
err := portal.ForwardBackfill()
if err != nil {
user.log.Warnfln("Forward backfill for portal %s failed: %v", portal.Key, err)
if user.bridge.Config.Bridge.Backfill.Enable {
user.BridgeStates[userTeam.Key.TeamID].Send(status.BridgeState{StateEvent: status.StateBackfilling})

portals := user.bridge.dbPortalsToPortals(user.bridge.DB.Portal.GetAllForUserTeam(userTeam.Key))
for _, portal := range portals {
err := portal.ForwardBackfill()
if err != nil {
user.log.Warnfln("Forward backfill for portal %s failed: %v", portal.Key, err)
}
}
}
user.BridgeStates[userTeam.Key.TeamID].Send(status.BridgeState{StateEvent: status.StateConnected})
Expand Down

0 comments on commit 4530ff3

Please sign in to comment.