feat(tlk): persist Toloka session in Redis across cold starts

Store the serialized cookie jar in Upstash Redis after login and
restore it on instance start, so serverless cold starts reuse the
session instead of re-authenticating. Falls back to the previous
in-memory behavior when Redis is not configured or unavailable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
nerandClaude Fable 5 committed 2026-08-06 21:02:13 +03:00
1 parent 16601f20f3
commit 131beeb07f
7 files changed
+105 -3

No files matched your search

+29
View File
@@ -18,6 +18,7 @@
"@tanstack/react-query": "^5.59.15",
"@tanstack/react-query-next-experimental": "^5.59.16",
"@types/cheerio": "^0.22.35",
"@upstash/redis": "^1.38.2",
"@vidstack/react": "^1.12.13",
"axios": "^1.7.7",
"axios-cookiejar-support": "^5.0.3",
@@ -4599,6 +4600,15 @@
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@upstash/redis": {
"version": "1.38.2",
"resolved": "https://registry.npmjs.org/@upstash/redis/-/redis-1.38.2.tgz",
"integrity": "sha512-RZ+JaRCVIS+ZTGnjOnDMr+/0aqDxsBb5rV6aW+Pys4SGELwr5lwE3UbLHRCHqMQ5Ulxj0b/CFBHfbmE175Otog==",
"license": "MIT",
"dependencies": {
"uncrypto": "^0.1.3"
}
},
"node_modules/@vidstack/react": {
"version": "1.12.13",
"resolved": "https://registry.npmjs.org/@vidstack/react/-/react-1.12.13.tgz",
@@ -11790,6 +11800,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/uncrypto": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz",
"integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==",
"license": "MIT"
},
"node_modules/undici": {
"version": "6.20.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz",
@@ -15180,6 +15196,14 @@
"eslint-visitor-keys": "^3.3.0"
}
},
"@upstash/redis": {
"version": "1.38.2",
"resolved": "https://registry.npmjs.org/@upstash/redis/-/redis-1.38.2.tgz",
"integrity": "sha512-RZ+JaRCVIS+ZTGnjOnDMr+/0aqDxsBb5rV6aW+Pys4SGELwr5lwE3UbLHRCHqMQ5Ulxj0b/CFBHfbmE175Otog==",
"requires": {
"uncrypto": "^0.1.3"
}
},
"@vidstack/react": {
"version": "1.12.13",
"resolved": "https://registry.npmjs.org/@vidstack/react/-/react-1.12.13.tgz",
@@ -20027,6 +20051,11 @@
"which-boxed-primitive": "^1.0.2"
}
},
"uncrypto": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz",
"integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q=="
},
"undici": {
"version": "6.20.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz",