Skip to content

Commit 6fc9db3

Browse files
committed
Clean up
1 parent 21f4652 commit 6fc9db3

4 files changed

Lines changed: 8 additions & 105 deletions

File tree

web/app/[locale]/(pages)/news/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const getInitialResponse = unstable_cache(
7676
},
7777
undefined,
7878
{
79-
tags: ['newsroom'],
79+
tags: [`newsroom_en-GB`],
8080
},
8181
)
8282

web/app/[locale]/(pages)/nyheter/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const getInitialResponse = unstable_cache(
4242
},
4343
undefined,
4444
{
45-
tags: ['newsroom'],
45+
tags: [`newsroom_nb-NO`],
4646
},
4747
)
4848

web/app/api/revalidate-tag/route.ts

Lines changed: 0 additions & 79 deletions
This file was deleted.

web/app/api/update-algolia-indexes/route.ts

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,18 @@ export async function POST(req: NextRequest) {
4444

4545
const data = JSON.parse(body)
4646

47-
const revalidateNewsroomPages = async () => {
48-
console.log(new Date(), 'Revalidating: /news')
49-
revalidateTag('newsroom', 'max')
50-
//revalidatePath('/news')
51-
//revalidatePath('/no/nyheter')
52-
}
53-
5447
if (data._type === 'news') {
5548
// wait for news index and revalidate...
5649
const response = await updateAlgoliaIndex(body)
5750
if (Number(response.status) === 200) {
5851
const algoliaTaskIds = await response.json()
5952
console.log('Algolia Indexing Success', algoliaTaskIds)
60-
// wait for a second revalidate newsroom pages
61-
/* const sleep = (delay: number) =>
62-
new Promise(resolve => setTimeout(resolve, delay))
63-
await sleep(1000) // wait for a second to let algolia index temporary fix as we dont know the status yet
64-
*/
65-
// Extract and wait for all tasks in parallel
66-
/*const tasks = algoliaTaskIds.map((taskID: number) => {
67-
const envPrefix = Flags.IS_GLOBAL_PROD ? 'prod' : 'dev'
68-
const indexName = `${envPrefix}_NEWS_${data.language}`
69-
return algoliaClient.waitForTask({
70-
indexName: indexName,
71-
taskID: taskID,
72-
})
73-
})
74-
const statuses = await Promise.all(tasks)
75-
console.log('Algolia Indexing Statuses:', statuses)*/
76-
await revalidateNewsroomPages()
53+
console.log(
54+
new Date(),
55+
'Revalidating by tag ',
56+
`newsroom_${data.language}`,
57+
)
58+
revalidateTag(`newsroom_${data.language}`, 'max')
7759
return new Response(
7860
JSON.stringify({ message: 'Index updated and newsroom revalidated' }),
7961
{ status: 200 },

0 commit comments

Comments
 (0)