Skip to content

Commit

Permalink
fix: don't add_channels when there's none to add (#634)
Browse files Browse the repository at this point in the history
Closes: SYNC-4154
  • Loading branch information
pjenvey authored Feb 22, 2024
1 parent 2540ff8 commit b0ffa8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autopush-common/src/db/dual/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,11 @@ impl DbClient for DualClientImpl {
self.primary.add_user(&user).await?;
self.metrics.incr_with_tags("database.migrate").send();
let channels = self.secondary.get_channels(uaid).await?;
// NOTE: add_channels doesn't write a new version:
// user.version is still valid
self.primary.add_channels(uaid, channels).await?;
if !channels.is_empty() {
// NOTE: add_channels doesn't write a new version:
// user.version is still valid
self.primary.add_channels(uaid, channels).await?;
}
return Ok(Some(user));
}
}
Expand Down

0 comments on commit b0ffa8c

Please sign in to comment.