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: update edge to new delta format #698

Merged
merged 5 commits into from
Jan 31, 2025
Merged

feat: update edge to new delta format #698

merged 5 commits into from
Jan 31, 2025

Conversation

sjaanus
Copy link
Collaborator

@sjaanus sjaanus commented Jan 30, 2025

Make edge support the new delta format.

Copy link

github-actions bot commented Jan 30, 2025

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

server/Cargo.toml

PackageVersionLicenseIssue Type
unleash-yggdrasil>= 0.16.1, < 0.17.0NullUnknown License
Denied Licenses: GPL-1.0, GPL-2.0, GPL-3.0, LGPL-2.1, LGPL-3.0, AGPL-3.0

OpenSSF Scorecard

PackageVersionScoreDetails
cargo/unleash-types 0.15.6 UnknownUnknown
cargo/unleash-yggdrasil 0.16.1 UnknownUnknown
cargo/unleash-types >= 0.15.5, < 0.16.0 UnknownUnknown
cargo/unleash-yggdrasil >= 0.16.1, < 0.17.0 UnknownUnknown

Scanned Files

  • Cargo.lock
  • server/Cargo.toml

@@ -80,7 +80,7 @@ impl FeatureCache {
.and_modify(|existing_features| {
existing_features.modify_in_place(delta);
})
.or_insert(client_features);
.or_insert(client_features.modify_and_copy(delta));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can not put the values directly in, but need to run it through types method that parses events.

Copy link
Member

Choose a reason for hiding this comment

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

Seems a bit unfortunate that we have to construct a new ClientFeatures just so modify_and_copy can clone it.

Running through the types code, it looks like modify_in_place and modify_and_copy are sharing the bulk of their code. Ideally the bulk of that method would be extracted to something that they could both share and a third method could be created that builds a ClientFeatures from a delta

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I thought about that also at one point, but did not want to make it complex. I will take a look now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Regarding the construction of new ClientFeatures, we need to construct it anyways at one point if the value is not in cache.

@@ -403,15 +403,24 @@ impl FeatureRefresher {
.unleash_client
.get_client_features_delta(ClientFeaturesRequest {
api_key: refresh.token.token.clone(),
etag: refresh.etag.clone(),
etag: None,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No point to pass in this etag, because etags are different for old api and delta api.

Choose a reason for hiding this comment

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

I'm curious, don't we still need an etag here?

Copy link

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

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

LGTM

@sjaanus sjaanus merged commit 12cbc16 into main Jan 31, 2025
17 checks passed
@sjaanus sjaanus deleted the update-edge branch January 31, 2025 09:34
@unleash-bot unleash-bot bot mentioned this pull request Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants