-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add ETag to track the changed status of an object on the server #14
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
base: main
Are you sure you want to change the base?
feat: add ETag to track the changed status of an object on the server #14
Conversation
|
hi @habedi , I implemented the Etag to track the changed status of an object on the server. It accomplishes that the synchronization between local and remote files. Could you pls help me review this PR? |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these libraries (added in the infera/Cargo.toml) needed as main dependencies? It seems to me they are needed for tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .create(); | ||
| let url = format!("{}/ok_model.onnx", server.url()); | ||
| #[actix_web::test] | ||
| async fn test_remote_model_download_and_cache_with_etag_enabled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use mockito instead of actix-web, and make all the tests blocking (no async test)? TBH I think using actix-web is a bit of over-engineering at the moment.
| } | ||
|
|
||
| #[actix_web::test] | ||
| async fn test_remote_model_download_and_cache_with_etag_disabled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use mockito instead of actix-web, and make all the tests blocking (no async test)? TBH I think using actix-web is a bit of over-engineering at the moment.
| hex = "0.4" | ||
| filetime = "0.2" | ||
|
|
||
| tokio = { version = "1", features = ["full"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need tokio, especially with all of its features enabled. I think, at the moment, Infera itself doesn't do anything that requires an async IO runtime.
Summary
Version:
latest version
Resolve for issues:
issues-13
Changes
Fixes the bug by adding proper ETag validation before assuming the local cache is valid.
Ensures that cached files are only reused if the server confirms no changes via ETag.
Otherwise, downloads the updated file and updates the cache accordingly.
Add test cases covering both scenarios: server-side support for ETag and lack of ETag support.
Refactor other test cases in http.rs file
Impact