Skip to content

Commit 042011a

Browse files
author
Nicolas Dorseuil
committed
temp disable tag and queue in the server
1 parent 2a9d1db commit 042011a

File tree

2 files changed

+39
-33
lines changed

2 files changed

+39
-33
lines changed
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import type { Queue } from '@opennextjs/aws/types/overrides.js';
2-
import { getCloudflareContext } from '@opennextjs/cloudflare';
2+
// import { getCloudflareContext } from '@opennextjs/cloudflare';
33

4+
// biome-ignore lint/correctness/noUnusedVariables: <explanation>
45
interface Env {
56
MIDDLEWARE_REFERENCE?: Pick<Queue, 'send'>;
67
}
78

89
export default {
910
name: 'GitbookISRQueue',
11+
// biome-ignore lint/correctness/noUnusedVariables: <explanation>
1012
send: async (msg) => {
11-
const { env, ctx } = getCloudflareContext();
12-
ctx.waitUntil((env as Env).MIDDLEWARE_REFERENCE?.send(msg) ?? Promise.resolve());
13+
//TODO: Re add this
14+
// const { env, ctx } = getCloudflareContext();
15+
// ctx.waitUntil((env as Env).MIDDLEWARE_REFERENCE?.send(msg) ?? Promise.resolve());
1316
},
1417
} satisfies Queue;
Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
import type { NextModeTagCache } from '@opennextjs/aws/types/overrides.js';
2-
import { getCloudflareContext } from '@opennextjs/cloudflare';
32

4-
interface Env {
5-
MIDDLEWARE_REFERENCE?: Pick<
6-
NextModeTagCache,
7-
'getLastRevalidated' | 'hasBeenRevalidated' | 'writeTags' | 'getPathsByTags'
8-
>;
9-
}
3+
// interface Env {
4+
// MIDDLEWARE_REFERENCE?: Pick<
5+
// NextModeTagCache,
6+
// 'getLastRevalidated' | 'hasBeenRevalidated' | 'writeTags' | 'getPathsByTags'
7+
// >;
8+
// }
109

10+
//TODO: Reenable all of this.
1111
export default {
1212
name: 'GitbookTagCache',
1313
mode: 'nextMode',
14-
getLastRevalidated: async (tags: string[]) => {
15-
try {
16-
const { env } = getCloudflareContext();
17-
return (env as Env).MIDDLEWARE_REFERENCE?.getLastRevalidated(tags) ?? 0;
18-
} catch (error) {
19-
console.error('Server - Error getting last revalidated tags:', error);
20-
return 0; // Fallback to 0 if there's an error
21-
}
14+
getLastRevalidated: async (_tags: string[]) => {
15+
return 0;
16+
// try {
17+
// const { env } = getCloudflareContext();
18+
// return (env as Env).MIDDLEWARE_REFERENCE?.getLastRevalidated(tags) ?? 0;
19+
// } catch (error) {
20+
// console.error('Server - Error getting last revalidated tags:', error);
21+
// return 0; // Fallback to 0 if there's an error
22+
// }
2223
},
23-
hasBeenRevalidated: async (tags: string[]) => {
24-
try {
25-
const { env } = getCloudflareContext();
26-
return (env as Env).MIDDLEWARE_REFERENCE?.hasBeenRevalidated(tags) ?? false;
27-
} catch (error) {
28-
console.error('Server - Error checking if tags have been revalidated:', error);
29-
return false; // Fallback to false if there's an error
30-
}
24+
hasBeenRevalidated: async (_tags: string[]) => {
25+
// try {
26+
// const { env } = getCloudflareContext();
27+
// return (env as Env).MIDDLEWARE_REFERENCE?.hasBeenRevalidated(tags) ?? false;
28+
// } catch (error) {
29+
// console.error('Server - Error checking if tags have been revalidated:', error);
30+
// return false; // Fallback to false if there's an error
31+
// }
32+
return false;
3133
},
32-
writeTags: async (tags: string[]) => {
33-
try {
34-
const { env } = getCloudflareContext();
35-
(env as Env).MIDDLEWARE_REFERENCE?.writeTags(tags);
36-
} catch (error) {
37-
console.error('Server - Error writing tags:', error);
38-
}
34+
writeTags: async (_tags: string[]) => {
35+
// try {
36+
// const { env } = getCloudflareContext();
37+
// (env as Env).MIDDLEWARE_REFERENCE?.writeTags(tags);
38+
// } catch (error) {
39+
// console.error('Server - Error writing tags:', error);
40+
// }
41+
return;
3942
},
4043
} satisfies NextModeTagCache;

0 commit comments

Comments
 (0)