mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-05 19:30:48 -05:00
chore: changes storage cache to 5 minutes (#5196)
This commit is contained in:
@@ -19,7 +19,7 @@ export const getFile = async (
|
||||
headers: {
|
||||
"Content-Type": metaData.contentType,
|
||||
"Content-Disposition": "attachment",
|
||||
"Cache-Control": "public, max-age=1200, s-maxage=1200, stale-while-revalidate=300",
|
||||
"Cache-Control": "public, max-age=300, s-maxage=300, stale-while-revalidate=300",
|
||||
Vary: "Accept-Encoding",
|
||||
},
|
||||
});
|
||||
@@ -35,10 +35,7 @@ export const getFile = async (
|
||||
status: 302,
|
||||
headers: {
|
||||
Location: signedUrl,
|
||||
"Cache-Control":
|
||||
accessType === "public"
|
||||
? `public, max-age=3600, s-maxage=3600, stale-while-revalidate=300`
|
||||
: `public, max-age=600, s-maxage=3600, stale-while-revalidate=300`,
|
||||
"Cache-Control": "public, max-age=300, s-maxage=300, stale-while-revalidate=300",
|
||||
},
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -104,9 +104,6 @@ type TGetSignedUrlResponse =
|
||||
};
|
||||
|
||||
const getS3SignedUrl = async (fileKey: string): Promise<string> => {
|
||||
const [_, accessType] = fileKey.split("/");
|
||||
const expiresIn = accessType === "public" ? 60 * 60 : 10 * 60;
|
||||
|
||||
const getObjectCommand = new GetObjectCommand({
|
||||
Bucket: S3_BUCKET_NAME,
|
||||
Key: fileKey,
|
||||
@@ -114,7 +111,7 @@ const getS3SignedUrl = async (fileKey: string): Promise<string> => {
|
||||
|
||||
try {
|
||||
const s3Client = getS3Client();
|
||||
return await getSignedUrl(s3Client, getObjectCommand, { expiresIn });
|
||||
return await getSignedUrl(s3Client, getObjectCommand, { expiresIn: 30 * 60 });
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user