Skip to content

Commit

Permalink
Measure the time to get a redirect slug
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyi committed Feb 14, 2025
1 parent e2bc022 commit 9d4d0a7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions functions/_common/redirectTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ export async function getRedirectForUrl(env: Env, url: URL): Promise<Response> {
extension,
})

const startTime = Date.now()
const redirectSlug = await getOptionalRedirectForSlug(slug, url, {
...env,
url,
})
const endTime = Date.now()
console.log("Time taken to get redirect slug", endTime - startTime, "ms")
console.log("Redirect slug", redirectSlug)
if (redirectSlug && redirectSlug !== slug) {
return createRedirectResponse(`${redirectSlug}${extension}`, url)
Expand Down

0 comments on commit 9d4d0a7

Please sign in to comment.