Skip to content

Commit

Permalink
Only initiate backfill when it's enabled
Browse files Browse the repository at this point in the history
Fixes #34
  • Loading branch information
twouters committed Sep 19, 2023
1 parent b963030 commit 74d11ef
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,13 @@ func (user *User) slackMessageHandler(userTeam *database.UserTeam) {

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) {
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 74d11ef

Please sign in to comment.