mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
adapters: remove runtime options, serve app always fresh to prevent race conditions
This commit is contained in:
@@ -41,10 +41,10 @@ describe("cf adapter", () => {
|
||||
});
|
||||
|
||||
adapterTestSuite<CloudflareBkndConfig, CloudflareContext<any>>(bunTestRunner, {
|
||||
makeApp: async (c, a, o) => {
|
||||
return await createApp(c, { env: a } as any, o);
|
||||
makeApp: async (c, a) => {
|
||||
return await createApp(c, { env: a } as any);
|
||||
},
|
||||
makeHandler: (c, a, o) => {
|
||||
makeHandler: (c, a) => {
|
||||
console.log("args", a);
|
||||
return async (request: any) => {
|
||||
const app = await createApp(
|
||||
@@ -53,7 +53,6 @@ describe("cf adapter", () => {
|
||||
connection: { url: DB_URL },
|
||||
},
|
||||
a as any,
|
||||
o,
|
||||
);
|
||||
return app.fetch(request);
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Hono } from "hono";
|
||||
import { serveStatic } from "hono/cloudflare-workers";
|
||||
import type { MaybePromise } from "bknd";
|
||||
import { $console } from "bknd/utils";
|
||||
import { createRuntimeApp, type RuntimeOptions } from "bknd/adapter";
|
||||
import { createRuntimeApp } from "bknd/adapter";
|
||||
import { registerAsyncsExecutionContext, makeConfig, type CloudflareContext } from "./config";
|
||||
|
||||
declare global {
|
||||
@@ -36,10 +36,6 @@ export type CloudflareBkndConfig<Env = CloudflareEnv> = RuntimeBkndConfig<Env> &
|
||||
export async function createApp<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
config: CloudflareBkndConfig<Env>,
|
||||
ctx: Partial<CloudflareContext<Env>> = {},
|
||||
opts: RuntimeOptions = {
|
||||
// by default, require the app to be rebuilt every time
|
||||
force: true,
|
||||
},
|
||||
) {
|
||||
const appConfig = await makeConfig(
|
||||
{
|
||||
@@ -53,7 +49,7 @@ export async function createApp<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
},
|
||||
ctx,
|
||||
);
|
||||
return await createRuntimeApp<Env>(appConfig, ctx?.env, opts);
|
||||
return await createRuntimeApp<Env>(appConfig, ctx?.env);
|
||||
}
|
||||
|
||||
// compatiblity
|
||||
|
||||
Reference in New Issue
Block a user