Merged in feature/warmup (pull request #1887)

* unified warmup function

Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-04-29 06:18:14 +00:00
parent bbbd665a32
commit c1505ce50e
33 changed files with 886 additions and 185 deletions

View File

@@ -0,0 +1,31 @@
import { env } from "@/env/server"
import { serverClient } from "@/lib/trpc/server"
import type { Lang } from "@/constants/languages"
import type { WarmupFunction, WarmupResult } from "."
export const warmupHotelData =
(lang: Lang): WarmupFunction =>
async (): Promise<WarmupResult> => {
if (!env.ENABLE_WARMUP_HOTEL) {
return {
status: "skipped",
}
}
try {
await serverClient().hotel.hotels.getDestinationsMapData({
lang,
warmup: true,
})
} catch (error) {
return {
status: "error",
error: error as Error,
}
}
return {
status: "completed",
}
}