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

This commit is contained in:
Alex van Andel authored and GitHub committed 2023-09-20 19:50:28 +01:00
1 parent 5ee962948f
commit fd02cc44fa
2 files changed
+2

No files matched your search

+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;