Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/noop-empty-revali…
Browse files Browse the repository at this point in the history
…date-tags
  • Loading branch information
pieh committed Dec 19, 2024
2 parents d0a7f47 + 871f7b9 commit 782a106
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 38 deletions.
45 changes: 10 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@netlify/edge-bundler": "^12.2.3",
"@netlify/edge-functions": "^2.11.0",
"@netlify/eslint-config-node": "^7.0.1",
"@netlify/functions": "^2.8.2",
"@netlify/functions": "^3.0.0",
"@netlify/serverless-functions-api": "^1.30.1",
"@netlify/zip-it-and-ship-it": "^9.41.0",
"@opentelemetry/api": "^1.8.0",
Expand Down
7 changes: 5 additions & 2 deletions src/run/handlers/cache.cts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { type Span } from '@opentelemetry/api'
import type { PrerenderManifest } from 'next/dist/build/index.js'
import { NEXT_CACHE_TAGS_HEADER } from 'next/dist/lib/constants.js'

import { name as nextRuntimePkgName, version as nextRuntimePkgVersion } from '../../../package.json'
import {
type CacheHandlerContext,
type CacheHandlerForMultipleVersions,
Expand All @@ -30,6 +31,8 @@ type TagManifest = { revalidatedAt: number }

type TagManifestBlobCache = Record<string, Promise<TagManifest>>

const purgeCacheUserAgent = `${nextRuntimePkgName}@${nextRuntimePkgVersion}`

export class NetlifyCacheHandler implements CacheHandlerForMultipleVersions {
options: CacheHandlerContext
revalidatedTags: string[]
Expand Down Expand Up @@ -353,7 +356,7 @@ export class NetlifyCacheHandler implements CacheHandlerForMultipleVersions {

getLogger().debug(`Purging CDN cache for: [${tag}]`)
requestContext.trackBackgroundWork(
purgeCache({ tags }).catch((error) => {
purgeCache({ tags, userAgent: purgeCacheUserAgent }).catch((error) => {
// TODO: add reporting here
getLogger()
.withError(error)
Expand Down Expand Up @@ -403,7 +406,7 @@ export class NetlifyCacheHandler implements CacheHandlerForMultipleVersions {
}),
)

await purgeCache({ tags }).catch((error) => {
await purgeCache({ tags, userAgent: purgeCacheUserAgent }).catch((error) => {
// TODO: add reporting here
getLogger()
.withError(error)
Expand Down

0 comments on commit 782a106

Please sign in to comment.