better design on animes and books page
This commit is contained in:
@@ -173,7 +173,7 @@ const start = async () => {
|
||||
await refreshPopularBooks();
|
||||
};
|
||||
|
||||
cron.schedule("*/30 * * * *", async () => {
|
||||
const job = cron.schedule("*/30 * * * *", async () => {
|
||||
try {
|
||||
await refreshAll();
|
||||
console.log("cache refreshed");
|
||||
@@ -190,6 +190,15 @@ const start = async () => {
|
||||
console.error("initial refresh failed", e)
|
||||
);
|
||||
console.log(`Server running at http://localhost:54322`);
|
||||
|
||||
const shutdown = async () => {
|
||||
job.stop();
|
||||
await fastify.close();
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
process.on("SIGINT", shutdown);
|
||||
process.on("SIGTERM", shutdown);
|
||||
} catch (err) {
|
||||
fastify.log.error(err);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user