@trieb.work/nextjs-turbo-redis-cache 1.9.1 → 1.10.0-beta.13

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.
Files changed (45) hide show
  1. package/.github/workflows/ci.yml +14 -2
  2. package/.github/workflows/release.yml +148 -7
  3. package/CHANGELOG.md +110 -0
  4. package/README.md +3 -1
  5. package/dist/index.js +13 -15
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +13 -15
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +15 -11
  10. package/playwright.config.ts +9 -0
  11. package/release.config.cjs +3 -2
  12. package/src/RedisStringsHandler.ts +11 -11
  13. package/test/browser/update-tag.browser.test.ts +41 -0
  14. package/test/integration/next-app-16-0-3/README.md +36 -0
  15. package/test/integration/next-app-16-0-3/eslint.config.mjs +18 -0
  16. package/test/integration/next-app-16-0-3/next.config.ts +7 -0
  17. package/test/integration/next-app-16-0-3/package.json +28 -0
  18. package/test/integration/next-app-16-0-3/pnpm-lock.yaml +4127 -0
  19. package/test/integration/next-app-16-0-3/postcss.config.mjs +7 -0
  20. package/test/integration/next-app-16-0-3/src/app/api/cached-static-fetch/route.ts +18 -0
  21. package/test/integration/next-app-16-0-3/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +27 -0
  22. package/test/integration/next-app-16-0-3/src/app/api/revalidatePath/route.ts +15 -0
  23. package/test/integration/next-app-16-0-3/src/app/api/revalidateTag/route.ts +20 -0
  24. package/test/integration/next-app-16-0-3/src/app/api/revalidated-fetch/route.ts +17 -0
  25. package/test/integration/next-app-16-0-3/src/app/api/uncached-fetch/route.ts +15 -0
  26. package/test/integration/next-app-16-0-3/src/app/favicon.ico +0 -0
  27. package/test/integration/next-app-16-0-3/src/app/globals.css +26 -0
  28. package/test/integration/next-app-16-0-3/src/app/layout.tsx +59 -0
  29. package/test/integration/next-app-16-0-3/src/app/page.tsx +755 -0
  30. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +19 -0
  31. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +34 -0
  32. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  33. package/test/integration/next-app-16-0-3/src/app/pages/no-fetch/default-page/page.tsx +55 -0
  34. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +19 -0
  35. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +35 -0
  36. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  37. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +19 -0
  38. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +32 -0
  39. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  40. package/test/integration/next-app-16-0-3/src/app/revalidation-interface.tsx +267 -0
  41. package/test/integration/next-app-16-0-3/src/app/update-tag-test/page.tsx +25 -0
  42. package/test/integration/next-app-16-0-3/tsconfig.json +34 -0
  43. package/test/integration/nextjs-cache-handler.integration.test.ts +81 -24
  44. package/tests/update-tag.spec.ts +33 -0
  45. package/vitest.browser.config.ts +10 -0
@@ -29,16 +29,18 @@ jobs:
29
29
  - next-app-15-0-3
30
30
  - next-app-15-3-2
31
31
  - next-app-15-4-7
32
+ - next-app-16-0-3
33
+
32
34
 
33
35
  steps:
34
36
  - name: Checkout code
35
- uses: actions/checkout@v3
37
+ uses: actions/checkout@v6
36
38
 
37
39
  - name: Install pnpm
38
40
  run: corepack enable
39
41
 
40
42
  - name: Setup Node.js
41
- uses: actions/setup-node@v3
43
+ uses: actions/setup-node@v6
42
44
  with:
43
45
  node-version: '20'
44
46
  cache: 'pnpm'
@@ -76,6 +78,16 @@ jobs:
76
78
  SKIP_BUILD: true
77
79
  NEXT_TEST_APP: ${{ matrix.next-test-app }}
78
80
 
81
+ - name: Install Playwright browsers (Next 16 only)
82
+ if: matrix.next-test-app == 'next-app-16-0-3'
83
+ run: pnpm exec playwright install --with-deps
84
+
85
+ - name: Run Playwright E2E tests (Next 16 only)
86
+ if: matrix.next-test-app == 'next-app-16-0-3'
87
+ run: pnpm test:e2e
88
+ env:
89
+ PLAYWRIGHT_BASE_URL: http://localhost:3055
90
+
79
91
  - name: Code Coverage Comments
80
92
  if: github.event_name == 'pull_request'
81
93
  uses: kcjpop/coverage-comments@v2.2
@@ -15,6 +15,7 @@ permissions:
15
15
  issues: write
16
16
  actions: write
17
17
  discussions: write
18
+ id-token: write
18
19
 
19
20
  jobs:
20
21
  release:
@@ -22,25 +23,165 @@ jobs:
22
23
 
23
24
  steps:
24
25
  - name: Checkout code
25
- uses: actions/checkout@v3
26
+ uses: actions/checkout@v6
26
27
 
27
28
  - name: Install pnpm
28
29
  run: corepack enable
29
30
 
30
31
  - name: Setup Node.js
31
- uses: actions/setup-node@v3
32
+ uses: actions/setup-node@v6
32
33
  with:
33
- node-version: '20'
34
+ node-version: '22'
34
35
  cache: 'pnpm'
35
36
 
36
37
  - name: Install dependencies
37
- run: pnpm install
38
+ run: pnpm install --frozen-lockfile
39
+ - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
40
+ run: npm audit signatures
38
41
 
39
42
  - name: Build project
40
- run: pnpm run build
43
+ run: pnpm build
44
+
45
+ - name: Show npm provenance config
46
+ env:
47
+ NPM_CONFIG_PROVENANCE: 'true'
48
+ run: |
49
+ node -v
50
+ npm -v
51
+ echo "NPM_CONFIG_PROVENANCE=$NPM_CONFIG_PROVENANCE"
52
+ npm config get provenance
53
+ node -e "console.log('package.json publishConfig.provenance=', require('./package.json')?.publishConfig?.provenance)"
41
54
 
42
55
  - name: Run Semantic Release
43
56
  env:
44
57
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for Semantic Release
45
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # NPM token for publishing
46
- run: npx semantic-release
58
+ NPM_CONFIG_PROVENANCE: 'true'
59
+ run: pnpm exec semantic-release
60
+
61
+ - name: Diagnostics (OIDC + npm config)
62
+ env:
63
+ NPM_CONFIG_PROVENANCE: 'true'
64
+ run: |
65
+ echo "github.ref_name=${{ github.ref_name }}"
66
+ echo "ACTIONS_ID_TOKEN_REQUEST_URL=${ACTIONS_ID_TOKEN_REQUEST_URL:+set}"
67
+ echo "ACTIONS_ID_TOKEN_REQUEST_TOKEN=${ACTIONS_ID_TOKEN_REQUEST_TOKEN:+set}"
68
+ echo "CI=${CI:-unset}"
69
+ npm config get registry
70
+ npm config get provenance
71
+
72
+ - name: Exchange GitHub OIDC token for npm token
73
+ id: npm-oidc
74
+ env:
75
+ NPM_PACKAGE_NAME: '@trieb.work/nextjs-turbo-redis-cache'
76
+ run: |
77
+ node <<'NODE'
78
+ const fs = require('node:fs');
79
+
80
+ const pkg = process.env.NPM_PACKAGE_NAME;
81
+ const reqUrl = process.env.ACTIONS_ID_TOKEN_REQUEST_URL;
82
+ const reqToken = process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
83
+
84
+ if (!pkg || !reqUrl || !reqToken) {
85
+ console.error('Missing required env for OIDC token retrieval');
86
+ process.exit(1);
87
+ }
88
+
89
+ const audience = 'npm:registry.npmjs.org';
90
+ const url = reqUrl + (reqUrl.includes('?') ? '&' : '?') + 'audience=' + encodeURIComponent(audience);
91
+
92
+ (async () => {
93
+ const idRes = await fetch(url, { headers: { Authorization: 'Bearer ' + reqToken } });
94
+ if (!idRes.ok) {
95
+ console.error('Failed to fetch GitHub OIDC token:', idRes.status, await idRes.text());
96
+ process.exit(1);
97
+ }
98
+
99
+ const idBody = await idRes.json();
100
+ const idToken = idBody.value;
101
+
102
+ const exUrl =
103
+ 'https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/' + encodeURIComponent(pkg);
104
+ const exRes = await fetch(exUrl, {
105
+ method: 'POST',
106
+ headers: { Authorization: 'Bearer ' + idToken },
107
+ });
108
+
109
+ const exText = await exRes.text();
110
+ if (!exRes.ok) {
111
+ console.error('OIDC token exchange with npm failed:', exRes.status, exText);
112
+ process.exit(1);
113
+ }
114
+
115
+ const exBody = JSON.parse(exText);
116
+ const npmToken = exBody.token;
117
+ if (!npmToken) {
118
+ console.error('npm exchange response missing token');
119
+ process.exit(1);
120
+ }
121
+
122
+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `node_auth_token=${npmToken}\n`);
123
+ const npmrcPath = `${process.env.RUNNER_TEMP}/npmrc`;
124
+ const npmrc = [
125
+ 'registry=https://registry.npmjs.org/',
126
+ 'always-auth=true',
127
+ '//registry.npmjs.org/:_authToken=' + npmToken,
128
+ '',
129
+ ].join('\n');
130
+ fs.writeFileSync(npmrcPath, npmrc, { encoding: 'utf8' });
131
+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `npmrc_path=${npmrcPath}\n`);
132
+ console.log('OIDC token exchange with npm registry succeeded');
133
+ })().catch((e) => {
134
+ console.error(e);
135
+ process.exit(1);
136
+ });
137
+ NODE
138
+
139
+ - name: Publish to npm (Trusted Publishing)
140
+ env:
141
+ NPM_CONFIG_PROVENANCE: 'true'
142
+ NPM_DIST_TAG: ${{ github.ref_name == 'beta' && 'beta' || 'latest' }}
143
+ NPM_CONFIG_USERCONFIG: ${{ steps.npm-oidc.outputs.npmrc_path }}
144
+ run: |
145
+ set -euo pipefail
146
+
147
+ echo "--- npm debug context (pre-publish) ---"
148
+ node -v
149
+ npm -v
150
+ echo "pwd=$(pwd)"
151
+ echo "NPM_CONFIG_USERCONFIG=${NPM_CONFIG_USERCONFIG}"
152
+ echo "NPM_CONFIG_PROVENANCE=${NPM_CONFIG_PROVENANCE}"
153
+ echo "NPM_DIST_TAG=${NPM_DIST_TAG}"
154
+
155
+ echo "--- npmrc (redacted) ---"
156
+ if [ -f "${NPM_CONFIG_USERCONFIG}" ]; then
157
+ sed -E 's#(//registry\.npmjs\.org/:_authToken=).*#\1***REDACTED***#' "${NPM_CONFIG_USERCONFIG}" || true
158
+ else
159
+ echo "npmrc missing at ${NPM_CONFIG_USERCONFIG}"
160
+ fi
161
+
162
+ echo "--- npm config list (redacted) ---"
163
+ npm config list -l | sed -E 's#(_authToken=).*#\1***REDACTED***#' || true
164
+
165
+ echo "--- npm ping / whoami (best effort) ---"
166
+ npm ping --registry https://registry.npmjs.org/ || true
167
+ npm whoami --registry https://registry.npmjs.org/ || true
168
+
169
+ echo "--- npm publish (verbose) ---"
170
+ publish_status=0
171
+ npm publish --provenance --access public --tag "$NPM_DIST_TAG" --registry https://registry.npmjs.org/ --loglevel verbose || publish_status=$?
172
+
173
+ echo "--- npm debug logs (redacted) ---"
174
+ if [ -d "$HOME/.npm/_logs" ]; then
175
+ ls -la "$HOME/.npm/_logs" || true
176
+ latest_log=$(ls -t "$HOME/.npm/_logs"/*-debug-*.log 2>/dev/null | head -n 1 || true)
177
+ if [ -n "${latest_log}" ] && [ -f "${latest_log}" ]; then
178
+ echo "latest_log=${latest_log}"
179
+ sed -E 's#(//registry\.npmjs\.org/:_authToken=).*#\1***REDACTED***#; s#(_authToken=).*#\1***REDACTED***#' "${latest_log}" || true
180
+ else
181
+ echo "No npm debug log found"
182
+ fi
183
+ else
184
+ echo "No npm logs directory found"
185
+ fi
186
+
187
+ exit $publish_status
package/CHANGELOG.md CHANGED
@@ -1,3 +1,113 @@
1
+ # [1.10.0-beta.13](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.12...v1.10.0-beta.13) (2025-12-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add comprehensive debugging and .npmrc configuration for npm trusted publishing ([8d4fabb](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/8d4fabb02062a7a771693277909555671e810835))
7
+
8
+ # [1.10.0-beta.12](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.11...v1.10.0-beta.12) (2025-12-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * implement OIDC token exchange for npm trusted publishing in release workflow ([3b3cea1](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/3b3cea152dfb183e918dac1b34c6a8277c300474))
14
+
15
+ # [1.10.0-beta.11](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.10...v1.10.0-beta.11) (2025-12-27)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * add diagnostics step to debug OIDC and npm configuration in release workflow ([6a7f3cf](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/6a7f3cf7cda23d57acb34d3bb4c4dd6ab7103ca7))
21
+
22
+ # [1.10.0-beta.10](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.9...v1.10.0-beta.10) (2025-12-27)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * add provenance, public access, and verbose logging to npm publish command ([2fccf3d](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/2fccf3d12c899e5aee38ea5d7c0cdce22dd83ce4))
28
+
29
+ # [1.10.0-beta.9](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.8...v1.10.0-beta.9) (2025-12-27)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * add git+ prefix to repository URL in package.json ([70f94df](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/70f94dff5059808eb4a2376950f3bb9fecb4511e))
35
+
36
+ # [1.10.0-beta.8](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.7...v1.10.0-beta.8) (2025-12-27)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * disable semantic-release npm publishing and add manual npm publish step with trusted publishing ([4cbf99d](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/4cbf99de560a6a466b5d10f945bd9640356ef444))
42
+
43
+ # [1.10.0-beta.7](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.6...v1.10.0-beta.7) (2025-12-26)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * remove empty auth token environment variables from release workflow ([8d4e87b](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/8d4e87b301842842cd3d0c0a8cb8401dbf100fa9))
49
+
50
+ # [1.10.0-beta.6](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.5...v1.10.0-beta.6) (2025-12-26)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * upgrade semantic-release and related dependencies to v25 ([63fd812](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/63fd812bc0815aa5155619faf9b36b9287daac21))
56
+ * use pnpm exec instead of pnpx for semantic-release command ([ca310c0](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/ca310c0e1b4150052787eba1709152d606d2d76d))
57
+
58
+ # [1.10.0-beta.5](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.4...v1.10.0-beta.5) (2025-12-26)
59
+
60
+
61
+ ### Bug Fixes
62
+
63
+ * remove registry-url and clear auth tokens in release workflow ([b0d9edb](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/b0d9edb4e8efa37500a4dfe4054a24f55582e60e))
64
+
65
+ # [1.10.0-beta.4](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.3...v1.10.0-beta.4) (2025-12-26)
66
+
67
+
68
+ ### Bug Fixes
69
+
70
+ * trigger beta release ([724ecbb](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/724ecbb6d76697818a2c6a863c98e144eed049d2))
71
+
72
+ # [1.10.0-beta.3](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.2...v1.10.0-beta.3) (2025-12-26)
73
+
74
+
75
+ ### Bug Fixes
76
+
77
+ * configure npm provenance in package.json publishConfig ([83a3017](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/83a301797396e98b739db199bfb3e97ee1c8565e))
78
+
79
+ # [1.10.0-beta.2](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.1...v1.10.0-beta.2) (2025-12-26)
80
+
81
+
82
+ ### Bug Fixes
83
+
84
+ * trigger beta release ([432b58f](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/432b58f661db20e5a8302d54679b16cc33a6dfb6))
85
+
86
+ # [1.10.0-beta.1](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.9.1...v1.10.0-beta.1) (2025-12-26)
87
+
88
+
89
+ ### Bug Fixes
90
+
91
+ * avoid overlapping redis reconnects ([4da291f](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/4da291f1a62ef8ffd9a8528640ee57b1367d0e25))
92
+ * cleanup ([c948fdf](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/c948fdfe0e6b5f70edc985b3cdda9cf2f002633a))
93
+ * folder structure ([93356fd](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/93356fd567c0f05fad92d3443da77216fd2cc28d))
94
+ * just testing around ([09bd26d](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/09bd26dc7b328945f11818a11446b3e5dd86c943))
95
+ * remove not needed attributes ([6c11e0d](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/6c11e0d574e6ae8d98c60f71ea70070415de9de7))
96
+ * testing with npm ([fa7ecb0](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/fa7ecb0283c2611918a3f780bc0c87cf2b28d5db))
97
+ * trigger beta release ([62ea418](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/62ea4182b65fac53f23a93418b9f4650ab717b60))
98
+
99
+
100
+ ### Features
101
+
102
+ * add Next.js 16.0.3 support with new caching API tests ([8a55040](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/8a55040dbecf564fc4d08c04ee35af7e727d2e30))
103
+ * add Playwright E2E tests to CI workflow for Next.js 16 ([4cde821](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/4cde821ed86bd5d1387751bb85922ada9d890199))
104
+ * add support for Next.js 16.0.3 (WIP) ([e873fe0](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/e873fe08e9659515fd7416c3805be5a3c074538d))
105
+ * adding 16-0.3 ([38923b2](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/38923b299a9600659d2ee6245cf01b702eeba33a))
106
+ * extend Next.js peer dependency support to version 16.0.3 ([4e63a5b](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/4e63a5b3270c1696112b532173a7f6d79711576a))
107
+ * extend Next.js peer dependency support to version 16.0.3 ([ffaa08a](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/ffaa08ac79df7345ea289dad3c0f921ec859cb8f))
108
+ * install Playwright browsers before running E2E tests in CI ([d74231a](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/d74231a4bdcf8d3ba90e5c7ee31008540c4a137e))
109
+ * migrate from Vitest browser mode to Playwright for E2E testing ([6c39c98](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/6c39c989a89625f1835b7b257328b7a5ec45de3c))
110
+
1
111
  ## [1.9.1](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.9.0...v1.9.1) (2025-11-24)
2
112
 
3
113
 
package/README.md CHANGED
@@ -25,8 +25,10 @@ Tested versions are:
25
25
  - Nextjs 15.0.3 + redis client 4.7.0
26
26
  - Nextjs 15.2.4 + redis client 4.7.0
27
27
  - Nextjs 15.3.2 + redis client 4.7.0
28
+ - Nextjs 15.4.7 + redis client 4.7.0
29
+ - Nextjs 16.0.3 + redis client 4.7.0 (cacheComponents: false)
28
30
 
29
- Currently PPR, 'use cache', cacheLife and cacheTag are not tested. Use these operations with caution and your own risk.
31
+ Currently PPR, 'use cache', cacheLife and cacheTag are not tested. Use these operations with caution and your own risk. [Cache Components](https://nextjs.org/docs/app/getting-started/cache-components) support is in development.
30
32
 
31
33
  ## Getting started
32
34
 
package/dist/index.js CHANGED
@@ -539,15 +539,16 @@ var RedisStringsHandler = class {
539
539
  error,
540
540
  killContainerOnErrorCount++
541
541
  );
542
- setTimeout(
543
- () => this.client.connect().catch((error2) => {
544
- console.error(
545
- "Failed to reconnect Redis client after connection loss:",
546
- error2
547
- );
548
- }),
549
- 1e3
550
- );
542
+ setTimeout(() => {
543
+ if (!this.client.isOpen && !this.client.isReady) {
544
+ this.client.connect().catch((error2) => {
545
+ console.error(
546
+ "Failed to reconnect Redis client after connection loss:",
547
+ error2
548
+ );
549
+ });
550
+ }
551
+ }, 1e3);
551
552
  if (this.killContainerOnErrorThreshold > 0 && killContainerOnErrorCount >= this.killContainerOnErrorThreshold) {
552
553
  console.error(
553
554
  "Redis client error threshold reached, disconnecting and exiting (please implement a restart process/container watchdog to handle this error)",
@@ -563,12 +564,9 @@ var RedisStringsHandler = class {
563
564
  });
564
565
  this.client.connect().then(() => {
565
566
  debug("green", "Redis client connected.");
566
- }).catch(() => {
567
- this.client.connect().catch((error) => {
568
- console.error("Failed to connect Redis client:", error);
569
- this.client.disconnect();
570
- throw error;
571
- });
567
+ }).catch((error) => {
568
+ console.error("Failed to connect Redis client:", error);
569
+ throw error;
572
570
  });
573
571
  } catch (error) {
574
572
  console.error("Failed to initialize Redis client");