Skip to content

Commit

Permalink
Avoid returning debugging requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba2k2 committed Jan 8, 2025
1 parent 9d7c8d3 commit 4187857
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/routes/pull-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ export async function pullSchema(
// try cached results
const cached = await env.PRODUCTS.get<ResponseData>(productKey, "json")
if (cached) {
// don't serve requests back
cached.requests = undefined
if (!forceUpdate) return cached
// make sure we're admin
let auth
Expand Down Expand Up @@ -250,6 +252,9 @@ export async function pullSchema(
responseContext.cachedAt = Date.now()
responseContext.cacheKey = productKey

// clear requests if no error
responseContext.requests = undefined

await env.PRODUCTS.put(
productKey,
JSON.stringify(responseContext, null, "\t"),
Expand All @@ -268,6 +273,7 @@ export async function pullSchema(
errors.push("Schema ID not found in activeResponse")
}

// indicate cache miss
responseContext.cachedAt = false
return {}
}

0 comments on commit 4187857

Please sign in to comment.