Skip to content

Commit

Permalink
backfill: stop history sync portal creation if client disconnects
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Nov 14, 2024
1 parent 1a48dc1 commit 5aee9f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/rs/zerolog v1.33.0
go.mau.fi/util v0.8.2-0.20241113135441-636f8643f367
go.mau.fi/webp v0.1.0
go.mau.fi/whatsmeow v0.0.0-20241113162158-4dcaa22ec558
go.mau.fi/whatsmeow v0.0.0-20241114122515-3c0f25d54c22
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f
golang.org/x/image v0.22.0
golang.org/x/net v0.31.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ go.mau.fi/util v0.8.2-0.20241113135441-636f8643f367 h1:GU0TYiAOU79p6r3jf3e4k5cdg
go.mau.fi/util v0.8.2-0.20241113135441-636f8643f367/go.mod h1:SVzC++wSl8Yq4YVQRClLPa1frNpSVDVP6mfkw/OvDbc=
go.mau.fi/webp v0.1.0 h1:BHObH/DcFntT9KYun5pDr0Ot4eUZO8k2C7eP7vF4ueA=
go.mau.fi/webp v0.1.0/go.mod h1:e42Z+VMFrUMS9cpEwGRIor+lQWO8oUAyPyMtcL+NMt8=
go.mau.fi/whatsmeow v0.0.0-20241113162158-4dcaa22ec558 h1:gFrc7ut4MYCHvI0j+WIkEwHdaept0MJ5DSbDfx8vNiE=
go.mau.fi/whatsmeow v0.0.0-20241113162158-4dcaa22ec558/go.mod h1:TsBdbxqTsOTiKXj2M/ipWWFGKebU+WcipK4LZnHfEJ4=
go.mau.fi/whatsmeow v0.0.0-20241114122515-3c0f25d54c22 h1:MqyzS+gnDLTGfbmQvmzbe7ZcsyEgkw2WDTWaC3AVnOo=
go.mau.fi/whatsmeow v0.0.0-20241114122515-3c0f25d54c22/go.mod h1:TsBdbxqTsOTiKXj2M/ipWWFGKebU+WcipK4LZnHfEJ4=
go.mau.fi/zeroconfig v0.1.3 h1:As9wYDKmktjmNZW5i1vn8zvJlmGKHeVxHVIBMXsm4kM=
go.mau.fi/zeroconfig v0.1.3/go.mod h1:NcSJkf180JT+1IId76PcMuLTNa1CzsFFZ0nBygIQM70=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
Expand Down
7 changes: 7 additions & 0 deletions pkg/connector/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ func (wa *WhatsAppClient) createPortalsFromHistorySync(ctx context.Context) {
var wg sync.WaitGroup
wg.Add(len(conversations))
for i := 0; i < len(conversations); i++ {
if ctx.Err() != nil {
log.Warn().Err(ctx.Err()).Msg("Context cancelled, stopping history sync portal creation")
return
} else if wa.Client == nil {
log.Warn().Msg("Client is nil, stopping history sync portal creation")
return
}
conv := conversations[i]
if conv.ChatJID == types.StatusBroadcastJID && !wa.Main.Config.EnableStatusBroadcast {
wg.Done()
Expand Down

0 comments on commit 5aee9f2

Please sign in to comment.