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

feat: normalize durations and timestamps #837

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

taddes
Copy link
Contributor

@taddes taddes commented Feb 7, 2025

Closes SYNC-4521

@taddes taddes self-assigned this Feb 7, 2025
@taddes taddes changed the title feat: normalize durations and timestamps WIP: feat: normalize durations and timestamps Feb 7, 2025
@taddes taddes force-pushed the feat/normalize_timestamps-SYNC-4521 branch 2 times, most recently from e1d4a9c to 5c59883 Compare February 7, 2025 14:29
@taddes taddes force-pushed the feat/normalize_timestamps-SYNC-4521 branch from 5c59883 to d89e5ed Compare February 7, 2025 14:38
@taddes taddes changed the title WIP: feat: normalize durations and timestamps feat: normalize durations and timestamps Feb 10, 2025
@taddes taddes marked this pull request as ready for review February 11, 2025 02:16
@@ -64,7 +64,7 @@ log = { version = "0.4", features = [
] }
mockall = "0.12"
mozsvc-common = "0.2"
openssl = { version = "0.10" }
openssl = { version = "0.10.70" }
Copy link
Member

Choose a reason for hiding this comment

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

We tend to not specify minor revisions here. It's a good balance of not having to touch Cargo.toml for every minor bump + allows cargo to figure out the latest version for us when needed -- which shouldn't matter to our code as minor revisions should be backwards compat/not change APIs.

To handle CVE/RUSTSECs in this way you can usually just do an e.g. cargo update -p openssl to bump to the latest 0.10 only in Cargo.lock

Copy link
Member

Choose a reason for hiding this comment

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

IIRC, Rust is a bit odd about versions, so
0.10.70 translates to "use anything between 0.10.70 and 0.11.0" (which is the same as ~0.10.70 and because there's a leading 0 it's special cased.)

If we need to lock to a specific version, we should use ^0.10.70

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, thx for that! Will do.

@@ -46,10 +48,10 @@ pub mod util;
/// "abandoned" and any router info assigned to a User Agent that has not contacted
/// Autopush in 60 days can be discarded.
///
const ONE_DAY_IN_SECONDS: u64 = 24 * 60 * 60;
pub const ONE_DAY_IN_SECONDS: u64 = Duration::days(1).num_seconds() as u64;
Copy link
Member

Choose a reason for hiding this comment

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

Huh. I thought the idea was that we'd make these Duration values, and only convert to seconds when we need to.

e.g.
.map(|ttl| min(ttl, MAX_NOTIFICATION_TTL.num_seconds() as i64)

Basically, strongly type TTL as a Duration so that we don't muck up how we work with them accidentally.

Copy link
Member

Choose a reason for hiding this comment

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

I believe Taddes is working on that (so this is currently a WIP)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, sorry! Hope you don't mind, but I converted this to a draft for now so I don't do more dumb drive-by's.

My apologies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sry, should have moved back to WIP. Wrestling with Prometheus all day and didn't put it back.

@jrconlin jrconlin marked this pull request as draft February 12, 2025 23:56
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.

3 participants