fix: license cache issue (#4337)

This commit is contained in:
Piyush Gupta
2024-11-20 12:51:57 +05:30
committed by GitHub
parent 23c9dc304a
commit 6f041bf693
3 changed files with 8 additions and 3 deletions
@@ -4,10 +4,11 @@ import {
TEnterpriseLicenseFeatures,
} from "@/modules/ee/license-check/types/enterprise-license";
import { HttpsProxyAgent } from "https-proxy-agent";
import { unstable_after as after } from "next/server";
import fetch from "node-fetch";
import { cache as reactCache } from "react";
import { prisma } from "@formbricks/database";
import { cache } from "@formbricks/lib/cache";
import { cache, revalidateTag } from "@formbricks/lib/cache";
import {
E2E_TESTING,
ENTERPRISE_LICENSE_KEY,
@@ -48,7 +49,6 @@ const setPreviousResult = async (previousResult: {
lastChecked: Date;
features: TEnterpriseLicenseFeatures | null;
}) => {
// revalidateTag(PREVIOUS_RESULTS_CACHE_TAG_KEY);
const { lastChecked, active, features } = previousResult;
await cache(
@@ -62,6 +62,10 @@ const setPreviousResult = async (previousResult: {
tags: [PREVIOUS_RESULTS_CACHE_TAG_KEY],
}
)();
after(() => {
revalidateTag(PREVIOUS_RESULTS_CACHE_TAG_KEY);
});
};
const fetchLicenseForE2ETesting = async (): Promise<{