feat: Add 300s accelerate cache to feature flags (#11464)

This commit is contained in:
Alex van Andel
2023-09-20 19:50:28 +01:00
committed by GitHub
parent 5ee962948f
commit fd02cc44fa
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -8,6 +8,7 @@ export const featureFlagRouter = router({
const { prisma } = ctx;
return prisma.feature.findMany({
orderBy: { slug: "asc" },
cacheStrategy: { swr: 300, ttl: 300 },
});
}),
map: publicProcedure.query(async ({ ctx }) => {
+1
View File
@@ -5,6 +5,7 @@ import type { AppFlags } from "../config";
export async function getFeatureFlagMap(prisma: PrismaClient) {
const flags = await prisma.feature.findMany({
orderBy: { slug: "asc" },
cacheStrategy: { swr: 300, ttl: 300 },
});
return flags.reduce<AppFlags>((acc, flag) => {
acc[flag.slug as keyof AppFlags] = flag.enabled;