Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: don't save legacy messages from the Rust node
Browse files Browse the repository at this point in the history
Closes #1198
  • Loading branch information
bbangert committed May 5, 2018
1 parent b8dca54 commit a218b5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autopush/webpush_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def to_WebPushNotification(self):
)

# If there's no sortkey_timestamp and no topic, its legacy
if not notif.sortkey_timestamp and not notif.topic:
if notif.sortkey_timestamp is None and not notif.topic:
notif.legacy = True

return notif
Expand Down
9 changes: 8 additions & 1 deletion autopush_rs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,14 @@ where
let unacked_direct_notifs = webpush.unacked_direct_notifs.len();
if unacked_direct_notifs > 0 {
stats.direct_storage += unacked_direct_notifs as i32;
let notifs = mem::replace(&mut webpush.unacked_direct_notifs, Vec::new());
let mut notifs = mem::replace(&mut webpush.unacked_direct_notifs, Vec::new());
// Ensure we don't store these as legacy by setting a 0 as the sortkey_timestamp
// That will ensure the Python side doesn't mark it as legacy during conversion and
// still get the correct default us_time when saving.
for notif in notifs.iter_mut() {
notif.sortkey_timestamp = Some(0);
}

srv.handle.spawn(srv.store_messages(
webpush.uaid.simple().to_string(),
webpush.message_month.clone(),
Expand Down

0 comments on commit a218b5b

Please sign in to comment.