Skip to content

Commit e9c0d7a

Browse files
committed
Invaliderer redis på alle podder for å hindre race conditions (todo: denne invalidering skal flyttes til revalidator-proxy)
1 parent d83d3a1 commit e9c0d7a

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

.nais/config.yml

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ spec:
2727
prometheus:
2828
enabled: true
2929
path: /internal/metrics
30-
leaderElection: true
3130
redis:
3231
- instance: {{ redis.instance }}
3332
access: readwrite

server/src/cache/page-cache-handler.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import FileSystemCache from 'next/dist/server/lib/incremental-cache/file-system-
22
import { LRUCache } from 'lru-cache';
33
import { CacheHandlerValue } from 'next/dist/server/lib/incremental-cache';
44
import { RedisCache } from 'srcCommon/redis';
5-
import { isLeaderPod } from 'leader-pod';
65
import { CACHE_TTL_24_HOURS_IN_MS } from 'srcCommon/constants';
76
import { pathToCacheKey } from 'srcCommon/cache-key';
87

@@ -59,17 +58,11 @@ export default class PageCacheHandler {
5958

6059
public async clear() {
6160
localCache.clear();
62-
63-
if (await isLeaderPod()) {
64-
return redisCache.clear();
65-
}
61+
return redisCache.clear();
6662
}
6763

6864
public async delete(path: string) {
6965
localCache.delete(pathToCacheKey(path));
70-
71-
if (await isLeaderPod()) {
72-
return redisCache.delete(path);
73-
}
66+
return redisCache.delete(path);
7467
}
7568
}

0 commit comments

Comments
 (0)