Files
fivenode_go/capi/napi_handler.prg
CharlesKWON 6a8ada16b2 feat(napi): VM pool + per-request isolation for serial/parallel handling
- fnode capi shim: single VM+mutex -> VM pool (FIVENODE_VM_POOL, default 4;
  1=serial, N=parallel). Each request checks out its own VM so PRG runs
  concurrently across libuv worker threads.
- per-request data keyed by VM (FN_NAPI_REQ via ctx.T.VM()) -- no shared
  capiReq race.
- napibridge: per-VM handle tracking; ReleaseAll(vm) auto-ends only that
  request's npm handles (parallel-safe auto-__end__). FN_AWAIT replaces the
  reserved Five AWAIT keyword (Clipper-compat, no gengo codegen -> NIL).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 08:57:31 +09:00

14 lines
534 B
Plaintext

FUNCTION FN_HANDLE()
LOCAL oQR := FN_REQUIRE( "qrcode" )
LOCAL cSvg
IF ! HB_ISOBJECT( oQR )
RETURN hb_jsonEncode( { "step" => "require", "err" => FN_LASTERROR() } )
ENDIF
cSvg := FN_AWAIT( oQR:toString( "https://solmade.kr", { "type" => "svg", "margin" => 2 } ) )
// __end__ 수동 호출 없음 — 요청 종료 시 ReleaseAll 이 자동 정리(P3)
RETURN hb_jsonEncode( { ;
"status" => 200, ;
"headers" => { "Content-Type" => "image/svg+xml" }, ;
"body" => hb_CStr( cSvg ) ;
} )