From 404c4a9e0385ed60efe78a70471244a77f432cee Mon Sep 17 00:00:00 2001 From: Xeu Date: Sun, 6 Oct 2024 16:45:16 +0800 Subject: [PATCH] fix: rss crontab exception (#265) --- package.json | 1 + server/src/_worker.ts | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/package.json b/package.json index 2f21424a..e28f885e 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "dev": "turbo dev", "dev:client": "bun --filter './client' dev", "dev:server": "bun wrangler dev --port 11498", + "dev:cron": "bun wrangler dev --port 11498 --test-scheduled", "check": "turbo check", "cf-deploy": "bun scripts/migrator.ts", "b": "turbo build", diff --git a/server/src/_worker.ts b/server/src/_worker.ts index 709aa9d6..755c378b 100644 --- a/server/src/_worker.ts +++ b/server/src/_worker.ts @@ -36,6 +36,17 @@ export default { env: Env, ctx: ExecutionContext ) { + const db = drizzle(env.DB, { schema: schema }) + Container.set(envToken, env) + Container.set(dbToken, db) + + const exist = Container.has("cache") + if (!exist) { + Container.set("cache", new CacheImpl()); + Container.set("server.config", new CacheImpl("server.config")); + Container.set("client.config", new CacheImpl("client.config")); + } + await friendCrontab(env, ctx) await rssCrontab(env) },