@trieb.work/nextjs-turbo-redis-cache 1.18.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +27 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
- package/.cursor/skills/testing/SKILL.md +0 -121
- package/.github/workflows/ci.yml +0 -309
- package/.github/workflows/pages.yml +0 -38
- package/.github/workflows/release.yml +0 -58
- package/.prettierrc.json +0 -6
- package/.vscode/settings.json +0 -10
- package/ARCHITECTURE.md +0 -470
- package/commitlint.config.cjs +0 -4
- package/docker/redis.conf +0 -1
- package/docs/index.html +0 -140
- package/docs/robots.txt +0 -4
- package/docs/sitemap.xml +0 -8
- package/docs/styles.css +0 -141
- package/eslint.config.mjs +0 -26
- package/hooks/commit-msg +0 -10
- package/hooks/pre-commit +0 -11
- package/playwright.config.ts +0 -18
- package/release.config.cjs +0 -12
- package/scripts/prepare.sh +0 -7
- package/scripts/setup-git.sh +0 -8
- package/scripts/setup-repo-name.sh +0 -17
- package/scripts/vitest-run-staged.cjs +0 -44
- package/src/CacheComponentsHandler.ts +0 -597
- package/src/CachedHandler.ts +0 -53
- package/src/DeduplicatedRequestHandler.ts +0 -110
- package/src/RedisStringsHandler.ts +0 -949
- package/src/SyncedMap.ts +0 -496
- package/src/ZodHandler.ts +0 -45
- package/src/index.ts +0 -23
- package/src/serializer.ts +0 -59
- package/src/utils/cacheTtl.ts +0 -71
- package/src/utils/compareAndUnlink.ts +0 -29
- package/src/utils/debug.ts +0 -30
- package/src/utils/json.ts +0 -49
- package/src/utils/prefix.ts +0 -44
- package/src/utils/redisConnection.ts +0 -17
- package/src/utils/tagRevalidation.ts +0 -162
- package/test/README.md +0 -194
- package/test/nextjs-test-projects/next-app-15-4-11/README.md +0 -36
- package/test/nextjs-test-projects/next-app-15-4-11/eslint.config.mjs +0 -16
- package/test/nextjs-test-projects/next-app-15-4-11/next.config.js +0 -9
- package/test/nextjs-test-projects/next-app-15-4-11/package-lock.json +0 -5969
- package/test/nextjs-test-projects/next-app-15-4-11/package.json +0 -29
- package/test/nextjs-test-projects/next-app-15-4-11/pnpm-lock.yaml +0 -3726
- package/test/nextjs-test-projects/next-app-15-4-11/postcss.config.mjs +0 -5
- package/test/nextjs-test-projects/next-app-15-4-11/public/file.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/public/globe.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/public/next.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/public/vercel.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/public/window.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/revalidatePath/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/revalidateTag/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/layout.tsx +0 -59
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-15-4-11/tsconfig.json +0 -27
- package/test/nextjs-test-projects/next-app-16-0-11/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-0-11/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-0-11/next.config.ts +0 -10
- package/test/nextjs-test-projects/next-app-16-0-11/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-0-11/pnpm-lock.yaml +0 -4163
- package/test/nextjs-test-projects/next-app-16-0-11/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/revalidatePath/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/revalidateTag/route.ts +0 -20
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/layout.tsx +0 -59
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/update-tag-test/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-0-11/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/cache-handler.js +0 -3
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/next.config.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/pnpm-lock.yaml +0 -4206
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/file.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/globe.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/next.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/vercel.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/window.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/cached-static-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/cached-with-cachelife/route.ts +0 -24
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/cached-with-tag/route.ts +0 -21
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/expire-matrix/revalidate/route.ts +0 -34
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/expire-matrix/route.ts +0 -23
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/revalidate-tag/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/revalidated-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/cachelife-short/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/page.tsx +0 -112
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/revalidate-durations/page.tsx +0 -106
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/runtime-data-suspense/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/stale-while-revalidate/page.tsx +0 -130
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/tag-invalidation/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/use-cache-nondeterministic/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/use-cache-remote/page.tsx +0 -85
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/layout.tsx +0 -57
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/update-tag-test/page.tsx +0 -22
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-2-6/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-2-6/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-2-6/next.config.ts +0 -7
- package/test/nextjs-test-projects/next-app-16-2-6/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-2-6/pnpm-lock.yaml +0 -4165
- package/test/nextjs-test-projects/next-app-16-2-6/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/revalidatePath/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/revalidateTag/route.ts +0 -20
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/layout.tsx +0 -59
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/update-tag-test/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-2-6/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/cache-handler.js +0 -3
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/next.config.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/pnpm-lock.yaml +0 -4165
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/file.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/globe.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/next.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/vercel.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/window.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-static-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-with-cachelife/route.ts +0 -24
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-with-tag/route.ts +0 -21
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/expire-matrix/revalidate/route.ts +0 -34
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/expire-matrix/route.ts +0 -23
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/revalidate-tag/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/revalidated-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/cachelife-short/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/page.tsx +0 -112
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/revalidate-durations/page.tsx +0 -106
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/runtime-data-suspense/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/stale-while-revalidate/page.tsx +0 -130
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/tag-invalidation/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/use-cache-nondeterministic/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/use-cache-remote/page.tsx +0 -85
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/layout.tsx +0 -57
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/update-tag-test/page.tsx +0 -22
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-3-0/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-3-0/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-3-0/next.config.ts +0 -7
- package/test/nextjs-test-projects/next-app-16-3-0/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-3-0/pnpm-lock.yaml +0 -4284
- package/test/nextjs-test-projects/next-app-16-3-0/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/revalidatePath/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/revalidateTag/route.ts +0 -20
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/layout.tsx +0 -59
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/update-tag-test/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-3-0/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/cache-handler.js +0 -3
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/next.config.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/pnpm-lock.yaml +0 -4284
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/file.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/globe.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/next.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/vercel.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/window.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/cached-static-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/cached-with-cachelife/route.ts +0 -24
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/cached-with-tag/route.ts +0 -21
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/expire-matrix/revalidate/route.ts +0 -34
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/expire-matrix/route.ts +0 -23
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/revalidate-tag/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/revalidated-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/cachelife-short/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/page.tsx +0 -112
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/revalidate-durations/page.tsx +0 -106
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/runtime-data-suspense/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/stale-while-revalidate/page.tsx +0 -130
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/tag-invalidation/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/use-cache-nondeterministic/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/use-cache-remote/page.tsx +0 -85
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/layout.tsx +0 -57
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/update-tag-test/page.tsx +0 -22
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-customized/README.md +0 -36
- package/test/nextjs-test-projects/next-app-customized/customized-cache-handler.js +0 -34
- package/test/nextjs-test-projects/next-app-customized/eslint.config.mjs +0 -16
- package/test/nextjs-test-projects/next-app-customized/next.config.js +0 -6
- package/test/nextjs-test-projects/next-pages-16-2-6/README.md +0 -16
- package/test/nextjs-test-projects/next-pages-16-2-6/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-pages-16-2-6/next.config.ts +0 -7
- package/test/nextjs-test-projects/next-pages-16-2-6/package.json +0 -26
- package/test/nextjs-test-projects/next-pages-16-2-6/pnpm-lock.yaml +0 -3896
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/api/revalidate.ts +0 -24
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/index.tsx +0 -11
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/isr/[slug].tsx +0 -49
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/static-forever.tsx +0 -20
- package/test/nextjs-test-projects/next-pages-16-2-6/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-pages-16-3-0/README.md +0 -16
- package/test/nextjs-test-projects/next-pages-16-3-0/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-pages-16-3-0/next.config.ts +0 -7
- package/test/nextjs-test-projects/next-pages-16-3-0/package.json +0 -26
- package/test/nextjs-test-projects/next-pages-16-3-0/pnpm-lock.yaml +0 -3939
- package/test/nextjs-test-projects/next-pages-16-3-0/src/pages/api/revalidate.ts +0 -24
- package/test/nextjs-test-projects/next-pages-16-3-0/src/pages/index.tsx +0 -11
- package/test/nextjs-test-projects/next-pages-16-3-0/src/pages/isr/[slug].tsx +0 -49
- package/test/nextjs-test-projects/next-pages-16-3-0/src/pages/static-forever.tsx +0 -20
- package/test/nextjs-test-projects/next-pages-16-3-0/tsconfig.json +0 -34
- package/test/playwright/cache-lab.spec.ts +0 -232
- package/test/playwright/update-tag.spec.ts +0 -33
- package/test/vitest/integration/build-id-prefix.integration.test.ts +0 -102
- package/test/vitest/integration/cache-components/cache-components.integration.test.ts +0 -389
- package/test/vitest/integration/cache-components/redis-kill-reconnect.test.ts +0 -65
- package/test/vitest/integration/cache-components/redis-quit-vs-disconnect.test.ts +0 -59
- package/test/vitest/integration/cache-components/redis-subscriber-outage.test.ts +0 -100
- package/test/vitest/integration/cache-components/scripts/redis-kill-reconnect.ts +0 -243
- package/test/vitest/integration/cache-components/scripts/redis-quit-vs-disconnect.ts +0 -113
- package/test/vitest/integration/cache-components/scripts/redis-subscriber-outage.ts +0 -379
- package/test/vitest/integration/cache-components/scripts/redis-test-helpers.ts +0 -155
- package/test/vitest/integration/nextjs-cache-handler.integration.test.ts +0 -959
- package/test/vitest/integration/pages-router.integration.test.ts +0 -430
- package/test/vitest/unit/SyncedMap-orphan-cleanup.test.ts +0 -111
- package/test/vitest/unit/SyncedMap-reconnect-repro.test.ts +0 -154
- package/test/vitest/unit/cache-components-update-tags.test.ts +0 -350
- package/test/vitest/unit/cache-ttl.test.ts +0 -67
- package/test/vitest/unit/compare-and-unlink.test.ts +0 -22
- package/test/vitest/unit/index.test.ts +0 -190
- package/test/vitest/unit/pages-router-kinds.test.ts +0 -303
- package/test/vitest/unit/reconnect-socket-already-opened.test.ts +0 -117
- package/test/vitest/unit/redis-connection.test.ts +0 -39
- package/test/vitest/unit/serializer.test.ts +0 -182
- package/test/vitest/unit/tag-revalidation.test.ts +0 -178
- package/test/vitest/unit/utils/prefix.test.ts +0 -115
- package/tsconfig.json +0 -18
- package/tsup.config.ts +0 -14
- package/vite.config.ts +0 -34
- package/vitest.cache-components.config.ts +0 -16
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'child_process';
|
|
2
|
-
|
|
3
|
-
type ContainerRuntime = 'podman' | 'docker';
|
|
4
|
-
|
|
5
|
-
function sh(cmd: string, args: string[], opts: { timeoutMs?: number } = {}) {
|
|
6
|
-
const res = spawnSync(cmd, args, {
|
|
7
|
-
encoding: 'utf8',
|
|
8
|
-
timeout: opts.timeoutMs ?? 30_000,
|
|
9
|
-
});
|
|
10
|
-
if (res.error) throw res.error;
|
|
11
|
-
return {
|
|
12
|
-
code: res.status ?? -1,
|
|
13
|
-
stdout: res.stdout ?? '',
|
|
14
|
-
stderr: res.stderr ?? '',
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function canRun(cmd: string) {
|
|
19
|
-
const res = spawnSync(cmd, ['--version'], {
|
|
20
|
-
encoding: 'utf8',
|
|
21
|
-
timeout: 3_000,
|
|
22
|
-
});
|
|
23
|
-
return !res.error && (res.status ?? 1) === 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function detectContainerRuntime(): ContainerRuntime {
|
|
27
|
-
if (process.env.CONTAINER_RUNTIME === 'podman') return 'podman';
|
|
28
|
-
if (process.env.CONTAINER_RUNTIME === 'docker') return 'docker';
|
|
29
|
-
|
|
30
|
-
if (canRun('podman')) return 'podman';
|
|
31
|
-
if (canRun('docker')) return 'docker';
|
|
32
|
-
|
|
33
|
-
throw new Error(
|
|
34
|
-
'Neither podman nor docker is available. Install one of them or set CONTAINER_RUNTIME.',
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function sleep(ms: number) {
|
|
39
|
-
await new Promise((r) => setTimeout(r, ms));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function waitUntil(fn: () => Promise<boolean>, timeoutMs = 20_000) {
|
|
43
|
-
const start = Date.now();
|
|
44
|
-
// eslint-disable-next-line no-constant-condition
|
|
45
|
-
while (true) {
|
|
46
|
-
if (await fn()) return;
|
|
47
|
-
if (Date.now() - start > timeoutMs) throw new Error('waitUntil timeout');
|
|
48
|
-
await sleep(200);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function main() {
|
|
53
|
-
const runtime = detectContainerRuntime();
|
|
54
|
-
const name = `redis-e2e-${Math.random().toString(36).slice(2, 8)}`;
|
|
55
|
-
|
|
56
|
-
// Pick a free localhost port
|
|
57
|
-
const net = await import('net');
|
|
58
|
-
const port: number = await new Promise((resolve, reject) => {
|
|
59
|
-
const srv = net.createServer();
|
|
60
|
-
srv.on('error', reject);
|
|
61
|
-
srv.listen(0, '127.0.0.1', () => {
|
|
62
|
-
const addr = srv.address();
|
|
63
|
-
if (!addr || typeof addr === 'string')
|
|
64
|
-
return reject(new Error('bad addr'));
|
|
65
|
-
const p = addr.port;
|
|
66
|
-
srv.close(() => resolve(p));
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// cleanup
|
|
71
|
-
sh(runtime, ['rm', '-f', name]);
|
|
72
|
-
|
|
73
|
-
// Start redis with keyspace notifications enabled (required by SyncedMap)
|
|
74
|
-
{
|
|
75
|
-
const r = sh(
|
|
76
|
-
runtime,
|
|
77
|
-
[
|
|
78
|
-
'run',
|
|
79
|
-
'-d',
|
|
80
|
-
'--rm',
|
|
81
|
-
'--name',
|
|
82
|
-
name,
|
|
83
|
-
'-p',
|
|
84
|
-
`${port}:6379`,
|
|
85
|
-
'docker.io/redis:7-alpine',
|
|
86
|
-
'redis-server',
|
|
87
|
-
'--notify-keyspace-events',
|
|
88
|
-
'Exe',
|
|
89
|
-
],
|
|
90
|
-
{ timeoutMs: 60_000 },
|
|
91
|
-
);
|
|
92
|
-
if (r.code !== 0) throw new Error(`podman run failed: ${r.stderr}`);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Set env BEFORE importing in case any module-level code reads REDIS_URL.
|
|
96
|
-
// (With lazy init the singleton is no longer created at import time, but
|
|
97
|
-
// setting env first is still good practice.)
|
|
98
|
-
process.env.REDIS_URL = `redis://127.0.0.1:${port}`;
|
|
99
|
-
process.env.VERCEL_URL = `e2e-${name}-`;
|
|
100
|
-
|
|
101
|
-
const { getRedisCacheComponentsHandler } = await import(
|
|
102
|
-
'../../../../../src/CacheComponentsHandler'
|
|
103
|
-
);
|
|
104
|
-
const { default: RedisStringsHandler } = await import(
|
|
105
|
-
'../../../../../src/RedisStringsHandler'
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
// Cache Components handler
|
|
109
|
-
const cacheComponentsHandler = getRedisCacheComponentsHandler({
|
|
110
|
-
redisUrl: `redis://127.0.0.1:${port}`,
|
|
111
|
-
socketOptions: {
|
|
112
|
-
connectTimeout: 2_000,
|
|
113
|
-
// allow redis client to reconnect; this scenario is about stability under restart
|
|
114
|
-
reconnectStrategy: (retries) => Math.min(50 + retries * 50, 500),
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
const cacheComponentsClient = (cacheComponentsHandler as any).client as {
|
|
119
|
-
ping: () => Promise<string>;
|
|
120
|
-
isReady: boolean;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
await waitUntil(async () => cacheComponentsClient.isReady, 20_000);
|
|
124
|
-
if ((await cacheComponentsClient.ping()) !== 'PONG') {
|
|
125
|
-
throw new Error('expected PONG (cache components)');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Regular handler
|
|
129
|
-
const regularHandler = new RedisStringsHandler({
|
|
130
|
-
redisUrl: `redis://127.0.0.1:${port}`,
|
|
131
|
-
socketOptions: {
|
|
132
|
-
connectTimeout: 2_000,
|
|
133
|
-
reconnectStrategy: (retries: number) => Math.min(50 + retries * 50, 500),
|
|
134
|
-
},
|
|
135
|
-
// Keep default offline queue behavior here; SyncedMap does initial sync during construction.
|
|
136
|
-
keyPrefix: `e2e-${name}-regular-`,
|
|
137
|
-
} as any);
|
|
138
|
-
|
|
139
|
-
const regularClient = (regularHandler as any).client as {
|
|
140
|
-
ping: () => Promise<string>;
|
|
141
|
-
isReady: boolean;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
await waitUntil(async () => regularClient.isReady, 20_000);
|
|
145
|
-
if ((await regularClient.ping()) !== 'PONG') {
|
|
146
|
-
throw new Error('expected PONG (regular handler)');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Seed a small entry so we know regular handler does real ops
|
|
150
|
-
await regularHandler.set(
|
|
151
|
-
'e2e-key',
|
|
152
|
-
{
|
|
153
|
-
kind: 'FETCH',
|
|
154
|
-
data: {
|
|
155
|
-
headers: {},
|
|
156
|
-
body: Buffer.from('hello').toString('base64'),
|
|
157
|
-
status: 200,
|
|
158
|
-
url: 'https://example.com/e2e',
|
|
159
|
-
},
|
|
160
|
-
revalidate: 10,
|
|
161
|
-
},
|
|
162
|
-
{ isRoutePPREnabled: false, isFallback: false, tags: ['e2e'] },
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
const got = await regularHandler.get('e2e-key', {
|
|
166
|
-
kind: 'FETCH',
|
|
167
|
-
revalidate: 10,
|
|
168
|
-
fetchUrl: 'https://example.com/e2e',
|
|
169
|
-
fetchIdx: 0,
|
|
170
|
-
tags: ['e2e'],
|
|
171
|
-
softTags: [],
|
|
172
|
-
isFallback: false,
|
|
173
|
-
});
|
|
174
|
-
if (!got) throw new Error('expected cache hit (regular handler)');
|
|
175
|
-
|
|
176
|
-
// Kill redis
|
|
177
|
-
sh(runtime, ['stop', '-t', '0', name], { timeoutMs: 30_000 });
|
|
178
|
-
|
|
179
|
-
// Wait a bit, then start again
|
|
180
|
-
await sleep(500);
|
|
181
|
-
|
|
182
|
-
{
|
|
183
|
-
const r = sh(
|
|
184
|
-
runtime,
|
|
185
|
-
[
|
|
186
|
-
'run',
|
|
187
|
-
'-d',
|
|
188
|
-
'--rm',
|
|
189
|
-
'--name',
|
|
190
|
-
name,
|
|
191
|
-
'-p',
|
|
192
|
-
`${port}:6379`,
|
|
193
|
-
'docker.io/redis:7-alpine',
|
|
194
|
-
'redis-server',
|
|
195
|
-
'--notify-keyspace-events',
|
|
196
|
-
'Exe',
|
|
197
|
-
],
|
|
198
|
-
{ timeoutMs: 60_000 },
|
|
199
|
-
);
|
|
200
|
-
if (r.code !== 0) throw new Error(`${runtime} run2 failed: ${r.stderr}`);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Should recover (both)
|
|
204
|
-
await waitUntil(async () => {
|
|
205
|
-
try {
|
|
206
|
-
return (await cacheComponentsClient.ping()) === 'PONG';
|
|
207
|
-
} catch {
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
}, 30_000);
|
|
211
|
-
|
|
212
|
-
await waitUntil(async () => {
|
|
213
|
-
try {
|
|
214
|
-
return (await regularClient.ping()) === 'PONG';
|
|
215
|
-
} catch {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
}, 30_000);
|
|
219
|
-
|
|
220
|
-
// Shut down clients before cleaning up Redis, otherwise reconnect loops keep the process alive.
|
|
221
|
-
try {
|
|
222
|
-
await (cacheComponentsHandler as any).client?.quit?.();
|
|
223
|
-
} catch {}
|
|
224
|
-
try {
|
|
225
|
-
await (regularHandler as any).client?.quit?.();
|
|
226
|
-
} catch {}
|
|
227
|
-
|
|
228
|
-
// cleanup best effort
|
|
229
|
-
sh(runtime, ['rm', '-f', name]);
|
|
230
|
-
|
|
231
|
-
// If we reach here without crashing due to Socket already opened, we're good.
|
|
232
|
-
// (Vitest will check stdout for this line.)
|
|
233
|
-
process.stdout.write('OK\n');
|
|
234
|
-
|
|
235
|
-
// Ensure we exit even if background reconnect timers exist.
|
|
236
|
-
process.exit(0);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
main().catch((err) => {
|
|
240
|
-
// Ensure we don't hide the key error string
|
|
241
|
-
console.error(err);
|
|
242
|
-
process.exit(1);
|
|
243
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Demonstrates the difference between quit() and disconnect() on a
|
|
3
|
-
* node-redis subscriber client while Redis is down.
|
|
4
|
-
*
|
|
5
|
-
* Scenario:
|
|
6
|
-
* 1. Start Redis.
|
|
7
|
-
* 2. Connect two subscriber clients and subscribe them.
|
|
8
|
-
* 3. Kill Redis and wait for the reconnect loop to start.
|
|
9
|
-
* 4. Subscriber A: call quit(). It should NOT resolve quickly while Redis is down.
|
|
10
|
-
* 5. Subscriber B: call disconnect(). It must close the socket immediately.
|
|
11
|
-
* 6. Restart Redis and verify that the disconnected subscriber stays dead.
|
|
12
|
-
*
|
|
13
|
-
* This shows why disconnect() is the correct teardown method during an outage.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { createClient } from 'redis';
|
|
17
|
-
import {
|
|
18
|
-
detectContainerRuntime,
|
|
19
|
-
getFreePort,
|
|
20
|
-
record,
|
|
21
|
-
sh,
|
|
22
|
-
sleep,
|
|
23
|
-
startRedis,
|
|
24
|
-
} from './redis-test-helpers';
|
|
25
|
-
|
|
26
|
-
async function createSubscriber(url: string) {
|
|
27
|
-
const client = createClient({
|
|
28
|
-
url,
|
|
29
|
-
socket: {
|
|
30
|
-
connectTimeout: 2_000,
|
|
31
|
-
reconnectStrategy: (retries: number) => Math.min(50 + retries * 50, 500),
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
client.on('error', () => {});
|
|
35
|
-
await client.connect();
|
|
36
|
-
await client.subscribe('test-channel', () => {});
|
|
37
|
-
return client;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function main() {
|
|
41
|
-
const runtime = detectContainerRuntime();
|
|
42
|
-
const name = `redis-quit-disc-${Math.random().toString(36).slice(2, 8)}`;
|
|
43
|
-
const port = await getFreePort();
|
|
44
|
-
|
|
45
|
-
sh(runtime, ['rm', '-f', name]);
|
|
46
|
-
startRedis(runtime, name, port);
|
|
47
|
-
|
|
48
|
-
const url = `redis://127.0.0.1:${port}`;
|
|
49
|
-
|
|
50
|
-
const quitSubscriber = await createSubscriber(url);
|
|
51
|
-
const disconnectSubscriber = await createSubscriber(url);
|
|
52
|
-
|
|
53
|
-
record(
|
|
54
|
-
'subscribers-ready',
|
|
55
|
-
quitSubscriber.isReady && disconnectSubscriber.isReady,
|
|
56
|
-
`quitSub isReady=${quitSubscriber.isReady}, disconnectSub isReady=${disconnectSubscriber.isReady}`,
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
// Kill Redis and let both clients enter their reconnect loops
|
|
60
|
-
sh(runtime, ['stop', '-t', '0', name], { timeoutMs: 30_000 });
|
|
61
|
-
await sleep(1_500);
|
|
62
|
-
|
|
63
|
-
// Test quit(): it should not resolve while Redis is unreachable.
|
|
64
|
-
const quitResult = await Promise.race([
|
|
65
|
-
quitSubscriber
|
|
66
|
-
.quit()
|
|
67
|
-
.then(() => 'resolved')
|
|
68
|
-
.catch((e) => `error:${e.message ?? e}`),
|
|
69
|
-
sleep(3_000).then(() => 'timeout'),
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
record(
|
|
73
|
-
'quit-does-not-immediately-close',
|
|
74
|
-
quitResult !== 'resolved',
|
|
75
|
-
`quit() result during outage: ${quitResult}`,
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
// Test disconnect(): it must close the client immediately, even during outage.
|
|
79
|
-
const disconnectStart = Date.now();
|
|
80
|
-
try {
|
|
81
|
-
await disconnectSubscriber.disconnect();
|
|
82
|
-
} catch (e: any) {
|
|
83
|
-
// If the client is already closed, that's still a successful teardown.
|
|
84
|
-
}
|
|
85
|
-
const disconnectDuration = Date.now() - disconnectStart;
|
|
86
|
-
|
|
87
|
-
record(
|
|
88
|
-
'disconnect-closes-immediately',
|
|
89
|
-
!disconnectSubscriber.isOpen && !disconnectSubscriber.isReady,
|
|
90
|
-
`disconnect() took ${disconnectDuration}ms, isOpen=${disconnectSubscriber.isOpen}, isReady=${disconnectSubscriber.isReady}`,
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
// Restart Redis and make sure the disconnected client does not come back.
|
|
94
|
-
startRedis(runtime, name, port);
|
|
95
|
-
await sleep(1_500);
|
|
96
|
-
|
|
97
|
-
record(
|
|
98
|
-
'disconnected-client-stays-dead',
|
|
99
|
-
!disconnectSubscriber.isOpen && !disconnectSubscriber.isReady,
|
|
100
|
-
`after restart: isOpen=${disconnectSubscriber.isOpen}, isReady=${disconnectSubscriber.isReady}`,
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
// Also clean up the quit subscriber so we don't leak the process.
|
|
104
|
-
try {
|
|
105
|
-
await quitSubscriber.disconnect();
|
|
106
|
-
} catch {}
|
|
107
|
-
sh(runtime, ['rm', '-f', name]);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
main().catch((err) => {
|
|
111
|
-
process.stderr.write(String(err) + '\n');
|
|
112
|
-
process.exit(1);
|
|
113
|
-
});
|