Commit 6367f9a3 authored by duanjinfei's avatar duanjinfei

fix update app time out

parent 67279f99
...@@ -42,7 +42,20 @@ const getTimestampForMidnight3AM = () => { ...@@ -42,7 +42,20 @@ const getTimestampForMidnight3AM = () => {
}; };
async function cacheAllApp(supabase, allApps, directory, bucketName) { async function cacheAllApp(supabase) {
// 获取所有 app 数据
const allApps = await fetchAllData(supabase, 'app');
// 获取当前时间的整点时间戳
const timestamp = getTimestampForMidnight3AM();
// 上传所有 app 数据到 storage
const directory = `app-category/${timestamp}`;
const bucketName = 'cache'; // 替换为存储桶名称
EdgeRuntime.waitUntil(cacheCategoryApp(supabase, allApps, directory, bucketName));
EdgeRuntime.waitUntil(cacheRentUpdateApp(supabase, allApps, directory, bucketName));
// 分页参数 // 分页参数
const pageSize = 30; const pageSize = 30;
const totalCount = allApps.length; const totalCount = allApps.length;
...@@ -152,21 +165,8 @@ Deno.serve(async (req) => { ...@@ -152,21 +165,8 @@ Deno.serve(async (req) => {
Deno.env.get('SUPABASE_ANON_KEY') ?? '', Deno.env.get('SUPABASE_ANON_KEY') ?? '',
{ global: { headers: { Authorization: req.headers.get('Authorization')! } } } { global: { headers: { Authorization: req.headers.get('Authorization')! } } }
) )
// 获取所有 app 数据
const allApps = await fetchAllData(supabase, 'app');
// 获取当前时间的整点时间戳
const timestamp = getTimestampForMidnight3AM();
// 上传所有 app 数据到 storage
const directory = `app-category/${timestamp}`;
const bucketName = 'cache'; // 替换为存储桶名称
EdgeRuntime.waitUntil(cacheAllApp(supabase, allApps, directory, bucketName));
EdgeRuntime.waitUntil(cacheCategoryApp(supabase, allApps, directory, bucketName));
EdgeRuntime.waitUntil(cacheRentUpdateApp(supabase, allApps, directory, bucketName));
EdgeRuntime.waitUntil(cacheAllApp(supabase));
return new Response( return new Response(
JSON.stringify({ JSON.stringify({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment