fix: 防止 HWPOD operation 重复派发
This commit is contained in:
@@ -32,6 +32,14 @@ const DEFAULT_BODY_LIMIT_BYTES = 1024 * 1024;
|
||||
|
||||
export async function handleHwpodNodeOpsHttp(request, response, options) {
|
||||
if (request.method === "GET") {
|
||||
const planId = new URL(request.url, "http://hwlab.local").searchParams.get("planId")?.trim() ?? "";
|
||||
if (planId) {
|
||||
const operation = options.hwpodNodeWsRegistry.lookup(planId);
|
||||
sendJson(response, operation ? 200 : 404, operation
|
||||
? { ok: true, status: operation.result ? "completed" : "running", contractVersion: HWPOD_NODE_OPS_CONTRACT_VERSION, ...operation }
|
||||
: { ok: false, status: "not-found", contractVersion: HWPOD_NODE_OPS_CONTRACT_VERSION, planId, error: { code: "hwpod_operation_not_found", message: `hwpod operation ${planId} was not found` } });
|
||||
return;
|
||||
}
|
||||
sendJson(response, 200, {
|
||||
ok: true,
|
||||
status: "ready",
|
||||
|
||||
Reference in New Issue
Block a user