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: gateway get durable object request function #1264

Merged
merged 3 commits into from
Feb 8, 2022

Conversation

vasco-santos
Copy link
Contributor

@vasco-santos vasco-santos commented Feb 7, 2022

Fixes two minor issues:

  • get durable object URL
  • when timeout we were not getting access to gateway URL nor properly handling abort error (code does not exist, at least in CF environment)

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 7, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: dcc29ba
Status: ✅  Deploy successful!
Preview URL: https://f6aa203e.nft-storage-1at.pages.dev

View logs

@vasco-santos vasco-santos force-pushed the fix/gateway-get-durable-request branch 2 times, most recently from e8f920a to f9735b5 Compare February 7, 2022 09:52
@vasco-santos vasco-santos requested a review from alanshaw February 7, 2022 09:57
@vasco-santos vasco-santos force-pushed the fix/gateway-get-durable-request branch 3 times, most recently from ddae244 to 30a6a16 Compare February 8, 2022 10:22
@vasco-santos vasco-santos requested review from alanshaw and removed request for alanshaw February 8, 2022 10:28
@vasco-santos vasco-santos force-pushed the fix/gateway-get-durable-request branch from 30a6a16 to 2e6d60b Compare February 8, 2022 10:59
if (controller.signal.aborted) {
return {
url: gwUrl,
aborted: true,
Copy link
Contributor

@alanshaw alanshaw Feb 8, 2022

Choose a reason for hiding this comment

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

Can we please be specific that this is a timeout (timeout: true), or have aborted + reason - where reason is timeout.

We could maybe roll requestPreventedCode into this:

{
  url: gwUrl,
  aborted: true,
  reason: REQUEST_PREVENTED_RATE_LIMIT_CODE
}

And for timeout:

{
  url: gwUrl,
  aborted: true,
  reason: 'TIMEOUT'
}

...for all other successful you set aborted: false.

Just trying to get a standard return type out of this.

@@ -288,6 +296,10 @@ async function updateGatewayMetrics(
gwResponse,
isWinner = false
) {
if (!gwResponse.response?.status && !gwResponse.requestPreventedCode) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be checking aborted instead?

@vasco-santos vasco-santos force-pushed the fix/gateway-get-durable-request branch from 7bd69a5 to dcc29ba Compare February 8, 2022 12:55
@vasco-santos vasco-santos merged commit 3e1795d into main Feb 8, 2022
@vasco-santos vasco-santos deleted the fix/gateway-get-durable-request branch February 8, 2022 13:00
hugomrdias added a commit that referenced this pull request Feb 8, 2022
* 'main' of github.com:nftstorage/nft.storage:
  fix: gateway get durable object request function (#1264)
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