Skip to content

Commit

Permalink
feat(server): add cron
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Jan 15, 2024
1 parent a94558f commit a0f4932
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/server/src/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ export function registerAdmin() {
return req.json(r);
});

app.post(`/admin/moe/resources`, async (req) => {
// const r = await refreshDmhyResources();
return req.json({});
});

app.post(`/admin/resources/sync`, async (req) => {
// Sync the database to the meilisearch documents
const r = await syncDocuments();
return req.json(r);
});
Expand Down
3 changes: 3 additions & 0 deletions packages/worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export default {
ctx.waitUntil(refreshResources(env));
break;
case '0 * * * *':
// Trigger zeabur
fetch(`https://animegarden-api.zeabur.app/admin/resources/sync`, { method: 'POST' });

ctx.waitUntil(fixResources(env, 1, 10));
break;
}
Expand Down

0 comments on commit a0f4932

Please sign in to comment.