-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[NFT Metadata Crawler] Asset Uploader API, Worker, Throttler #14837
Conversation
⏱️ 1h 30m total CI duration on this PR
|
b06b02d
to
44bfd22
Compare
) -> impl IntoResponse { | ||
match context.upload_asset(&request.url).await { | ||
Ok(res) => { | ||
let res = res.into_response(); // TODO: How to log response body? |
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.
wait which service is updating the db for request status and response? is it throttler or worker?
btw do we need to log the response if postgresdb will maintain request status and response?
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.
It's the throttler that performs the db updates, and it's just nice to log the body to help with debugging
async fn upload_asset(&self, url: &Url) -> anyhow::Result<impl IntoResponse> { | ||
let hashed_url = sha256::digest(url.to_string()); | ||
let client = Client::builder() | ||
.timeout(Duration::from_secs(MAX_ASSET_UPLOAD_RETRY_SECONDS)) |
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.
should this live in the config instead of const var? we might not know right away what's the best seconds to retry for
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.
This is just an arbitrarily high number. Theoretically, we should be nowhere near this limit because of the size limit for cloudflare.
ecosystem/nft-metadata-crawler/src/asset_uploader/worker/mod.rs
Outdated
Show resolved
Hide resolved
/// Converts a reqwest response to an axum response | ||
/// Only copies the response status, response body, and Content-Type header |
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.
wondering is it worth having these two libraries for incoming and outgoing http requests? what if we just a single rust library for requests? chatgpt suggested hyper?
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.
we previously used reqwest in nft netadata crawler, which is why i used reqwest here. Also hyper makes it very hard to submit multipart requests bc hyper too low level and doesnt support it out of the box
6cc119e
to
7ec2b26
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
Adaptation of the old Asset Uploader to the Asset Uploader Worker from the new design.
Design: https://www.notion.so/aptoslabs/WIP-Asset-Uploader-cb33138051324d1fa03115ef1b55ed0b
How Has This Been Tested?
Key Areas to Review
The service is even simpler than before. Please just look at overall logic and critique my coding style for Rust best practices.
Type of Change
Which Components or Systems Does This Change Impact?
Checklist