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

feat: port check storage command into Rust #1202

Merged
merged 1 commit into from
May 4, 2018
Merged

Conversation

bbangert
Copy link
Member

@bbangert bbangert commented May 3, 2018

Co-authored by: Phil Jenvey [email protected]

Some components of CheckStorage are left in Python as they're used
by the delete tests.

Closes #1189

@codecov-io
Copy link

codecov-io commented May 4, 2018

Codecov Report

Merging #1202 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #1202    +/-   ##
=======================================
  Coverage     100%    100%            
=======================================
  Files          60      60            
  Lines       10194   10344   +150     
=======================================
+ Hits        10194   10344   +150
Impacted Files Coverage Δ
autopush/tests/test_rs_integration.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83595a1...a9f6fc2. Read the comment docs.

jrconlin
jrconlin previously approved these changes May 4, 2018
if !RE.is_match(key) {
return Err("Invalid chidmessageid".into()).into();
}
if key.starts_with("01:") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part of me wonders if this should be a match...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think strings can be destructured to partial match right now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's easily a match once the duplicated split(":") line is done beforehand

Co-authored by: Phil Jenvey <[email protected]>

Some components of CheckStorage are left in Python as they're used
by the delete tests.

Closes #1189
Copy link
Contributor

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks reasonable to me!

Copy link
Member

@pjenvey pjenvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm requesting some changes but I'm also fine delaying them until after this is merged to make the rustfmt PR easier to manage

if !RE.is_match(key) {
return Err("Invalid chidmessageid".into()).into();
}
if key.starts_with("01:") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's easily a match once the duplicated split(":") line is done beforehand

encoding: Option<String>,
}

fn insert_to_map(map: &mut HashMap<String, String>, val: Option<String>, name: &str) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: order of val, name vs name, val mildly awkward

let response = response.and_then(|data| {
let notifs: Option<Vec<Notification>> = data.items.and_then(|items| {
debug!("Got response of: {:?}", items);
// TODO: Capture translation errors and report them as we shouldn't have corrupt data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should handle this now w/ all the serde_dynamodb errors we added

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I was saving this for after we go to Sentry 0.3 so we can easily log them out to Sentry.

}
Ok(FetchMessageResponse {
timestamp,
messages: notifs,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to go back and make this None when notifs.len() was 0 to match the python code exactly. I think it's better to make FetchMessageResponse's messages a raw Vec vs Option

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to change how the caller and responder work to do that as well, which is a bit more of a change than just porting the Python side.

@bbangert bbangert merged commit 4561031 into master May 4, 2018
@bbangert bbangert deleted the feat/issue-1189 branch May 4, 2018 17:29
pjenvey added a commit that referenced this pull request May 7, 2018
pjenvey added a commit that referenced this pull request May 7, 2018
bbangert added a commit that referenced this pull request May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants