Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: channel_id should be hyphenated #365

Merged
merged 1 commit into from
Apr 24, 2023
Merged

Conversation

pjenvey
Copy link
Member

@pjenvey pjenvey commented Apr 12, 2023

see remove_channel: it renders channel_id w/ Uuid::to_string (or via as_hyphenated in the old rust state machine db impl)

or autopush python's normalize_id: str(<uuid.UUID>)

SYNC-3444

see remove_channel: it renders channel_id w/ Uuid::to_string (or via as_hyphenated
in the old rust state machine db impl)

or autopush python's normalize_id: str(<uuid.UUID>)

SYNC-3444
@pjenvey pjenvey requested a review from jrconlin April 12, 2023 18:35
@pjenvey
Copy link
Member Author

pjenvey commented Apr 12, 2023

This might also be worth doing:

diff --git a/autopush-common/src/db/dynamodb/mod.rs b/autopush-common/src/db/dynamodb/mod.rs
index 060efd9..9c52b6a 100644
--- a/autopush-common/src/db/dynamodb/mod.rs
+++ b/autopush-common/src/db/dynamodb/mod.rs
@@ -268,7 +268,7 @@ impl DbClient for DdbClientImpl {
             },
             update_expression: Some("ADD chids :channel_id SET expiry = :expiry".to_string()),
             expression_attribute_values: Some(hashmap! {
-                ":channel_id".to_string() => val!(SS => Some(channel_id)),
+                ":channel_id".to_string() => val!(SS => Some(channel_id.as_hyphenated())),
                 ":expiry".to_string() => val!(N => sec_since_epoch() + MAX_CHANNEL_TTL)
             }),
             ..Default::default()
@@ -361,7 +361,7 @@ impl DbClient for DdbClientImpl {
             },
             update_expression: Some("DELETE chids :channel_id SET expiry = :expiry".to_string()),
             expression_attribute_values: Some(hashmap! {
-                ":channel_id".to_string() => val!(SS => Some(channel_id)),
+                ":channel_id".to_string() => val!(SS => Some(channel_id.as_hyphenated())),
                 ":expiry".to_string() => val!(N => sec_since_epoch() + MAX_CHANNEL_TTL)
             }),
             return_values: Some("UPDATED_OLD".to_string()),

@jrconlin
Copy link
Member

I wonder if we should just make a function that is "export_channel_id" or something that we always use whenever we are sending out a channel_id. Mostly just to encapsulate changes like .as_hyphenated() => .hyphenated() (or all the nonsense with base64 changes)

@pjenvey pjenvey merged commit 0067ae4 into master Apr 24, 2023
@pjenvey pjenvey deleted the fix/SYNC-3444-hyphenated-chid branch April 24, 2023 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants