Skip to content

Commit c817ba7

Browse files
committed
Remove unused handleQueue() function from entry worker (#678)
With #656, the Queues dispatcher is now implemented as part of the broker Durable Object. We no longer send message batches directly from Node.js, so can remove queue handling from the entry worker. Note the magic proxy enqueues messages through queue producer bindings like regular workers, so never used this endpoint directly.
1 parent 0960107 commit c817ba7

File tree

3 files changed

+1
-26
lines changed

3 files changed

+1
-26
lines changed

packages/miniflare/src/plugins/core/index.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,7 @@ export function getGlobalServices({
523523
durableObjectNamespace: { className: "ProxyServer" },
524524
},
525525
// Add `proxyBindings` here, they'll be added to the `ProxyServer` `env`.
526-
// It would be nice if we didn't add all these bindings to the entry worker,
527-
// but the entry worker shares lots of `devalue` code with the proxy, and
528-
// we'd rather not duplicate that.
526+
// TODO(someday): consider making the proxy server a separate worker
529527
...proxyBindings,
530528
];
531529
if (sharedOptions.upstream !== undefined) {

packages/miniflare/src/workers/core/constants.ts

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export const CoreHeaders = {
33
ORIGINAL_URL: "MF-Original-URL",
44
ERROR_STACK: "MF-Experimental-Error-Stack",
55
ROUTE_OVERRIDE: "MF-Route-Override",
6-
CUSTOM_EVENT: "MF-Custom-Event",
76

87
// API Proxy
98
OP: "MF-Op",

packages/miniflare/src/workers/core/entry.worker.ts

-22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { unflatten } from "devalue";
21
import {
32
Colorize,
43
blue,
@@ -11,7 +10,6 @@ import {
1110
} from "kleur/colors";
1211
import { LogLevel, SharedHeaders } from "miniflare:shared";
1312
import { CoreBindings, CoreHeaders } from "./constants";
14-
import { structuredSerializableRevivers } from "./devalue";
1513
import { STATUS_CODES } from "./http";
1614
import { WorkerRoute, matchRoutes } from "./routing";
1715

@@ -188,21 +186,6 @@ function handleProxy(request: Request, env: Env) {
188186
return stub.fetch(request);
189187
}
190188

191-
async function handleQueue(
192-
request: Request,
193-
url: URL,
194-
service: Fetcher,
195-
startTime: number
196-
) {
197-
const queueName = decodeURIComponent(url.pathname.substring(1));
198-
const flattened = await request.json<number | unknown[]>();
199-
const messages = unflatten(flattened, structuredSerializableRevivers);
200-
const queueResponse = await service.queue(queueName, messages);
201-
(queueResponse as FetcherQueueResult & { time: number }).time =
202-
Date.now() - startTime;
203-
return Response.json(queueResponse);
204-
}
205-
206189
async function handleScheduled(
207190
params: URLSearchParams,
208191
service: Fetcher
@@ -243,11 +226,6 @@ export default <ExportedHandler<Env>>{
243226
}
244227

245228
try {
246-
const customEvent = request.headers.get(CoreHeaders.CUSTOM_EVENT);
247-
if (customEvent === "queue") {
248-
return await handleQueue(request, url, service, startTime);
249-
}
250-
251229
if (url.pathname === "/cdn-cgi/mf/scheduled") {
252230
return await handleScheduled(url.searchParams, service);
253231
}

0 commit comments

Comments
 (0)