Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appbase-edge-function
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanjinfei
appbase-edge-function
Commits
6367f9a3
Commit
6367f9a3
authored
Dec 14, 2024
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix update app time out
parent
67279f99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
index.ts
supabase/functions/update-app/index.ts
+15
-15
No files found.
supabase/functions/update-app/index.ts
View file @
6367f9a3
...
@@ -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
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment