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

Commit

Permalink
Merge pull request #1250 from mozilla-services/feat/1249
Browse files Browse the repository at this point in the history
fix: ensure consistent_read on fetch messages fns
  • Loading branch information
bbangert authored May 22, 2018
2 parents 95d9b9f + ecd09c5 commit 56b79b2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions autopush_rs/src/db/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub fn fetch_messages(
key_condition_expression: Some("uaid = :uaid AND chidmessageid < :cmi".to_string()),
expression_attribute_values: Some(attr_values),
table_name: table_name.to_string(),
consistent_read: Some(true),
limit: Some(limit as i64),
..Default::default()
};
Expand Down Expand Up @@ -108,6 +109,7 @@ pub fn fetch_timestamp_messages(
key_condition_expression: Some("uaid = :uaid AND chidmessageid > :cmi".to_string()),
expression_attribute_values: Some(attr_values),
table_name: table_name.to_string(),
consistent_read: Some(true),
limit: Some(limit as i64),
..Default::default()
};
Expand All @@ -125,10 +127,6 @@ pub fn fetch_timestamp_messages(
.filter_map(|ddb_notif: DynamoDbNotification| ddb_notif.into_notif().ok())
.collect()
});
if messages.is_empty() {
return Ok(Default::default());
}

let timestamp = messages.iter().filter_map(|m| m.sortkey_timestamp).max();
Ok(FetchMessageResponse {
timestamp,
Expand Down

0 comments on commit 56b79b2

Please sign in to comment.