From: Jérôme Benoit Date: Tue, 15 Aug 2023 15:47:30 +0000 (+0200) Subject: docs: use kill handler in ws-cluster example X-Git-Tag: v2.6.27~11 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e8f1b6117053c649d1069dc758e5a379a442af5e;p=poolifier.git docs: use kill handler in ws-cluster example Signed-off-by: Jérôme Benoit --- diff --git a/examples/typescript/websocket-server-pool/ws-cluster/package.json b/examples/typescript/websocket-server-pool/ws-cluster/package.json index 0f963a9a..f5405bcd 100644 --- a/examples/typescript/websocket-server-pool/ws-cluster/package.json +++ b/examples/typescript/websocket-server-pool/ws-cluster/package.json @@ -19,7 +19,7 @@ "author": "", "license": "ISC", "dependencies": { - "poolifier": "^2.6.25", + "poolifier": "^2.6.26", "ws": "^8.13.0" }, "devDependencies": { diff --git a/examples/typescript/websocket-server-pool/ws-cluster/pnpm-lock.yaml b/examples/typescript/websocket-server-pool/ws-cluster/pnpm-lock.yaml index 5e00a095..caa1d26c 100644 --- a/examples/typescript/websocket-server-pool/ws-cluster/pnpm-lock.yaml +++ b/examples/typescript/websocket-server-pool/ws-cluster/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: poolifier: - specifier: ^2.6.25 - version: 2.6.25 + specifier: ^2.6.26 + version: 2.6.26 ws: specifier: ^8.13.0 version: 8.13.0(bufferutil@4.0.7)(utf-8-validate@6.0.3) @@ -79,15 +79,15 @@ packages: tslib: optional: true dependencies: - '@rollup/pluginutils': 5.0.2(rollup@3.28.0) + '@rollup/pluginutils': 5.0.3(rollup@3.28.0) resolve: 1.22.4 rollup: 3.28.0 tslib: 2.6.1 typescript: 5.1.6 dev: true - /@rollup/pluginutils@5.0.2(rollup@3.28.0): - resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} + /@rollup/pluginutils@5.0.3(rollup@3.28.0): + resolution: {integrity: sha512-hfllNN4a80rwNQ9QCxhxuHCGHMAvabXqxNdaChUSSadMre7t4iEUI6fFAhBOn/eIYTgYVhBv7vCLsAJ4u3lf3g==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0||^3.0.0 @@ -393,8 +393,8 @@ packages: engines: {node: '>=8.6'} dev: true - /poolifier@2.6.25: - resolution: {integrity: sha512-e8RNC8txuDO7x1ALNMDTUVWyrsMCod3krp/ZIhR+L9Q0KpoywwHekyWnRB4V2PYW/B1yxvXoPbQi1a2hZOfsNw==} + /poolifier@2.6.26: + resolution: {integrity: sha512-cfcP3oCwtxG5DzxLXicUQjr6ieJzX/5/yT2Nt0tBByhufqtu6V2Son7kJXSHlWrNa08Y39cOaeNrOLCazoJ07w==} engines: {node: '>=16.14.0', pnpm: '>=8.6.0'} requiresBuild: true dev: false diff --git a/examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts b/examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts index efe0facd..7785a0d6 100644 --- a/examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts +++ b/examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts @@ -62,7 +62,11 @@ class WebSocketServerWorker extends ClusterWorker { } public constructor () { - super(WebSocketServerWorker.startWebSocketServer) + super(WebSocketServerWorker.startWebSocketServer, { + killHandler: () => { + WebSocketServerWorker.wss.close() + } + }) } } diff --git a/src/index.ts b/src/index.ts index c9ee4c63..a4e22756 100644 --- a/src/index.ts +++ b/src/index.ts @@ -50,7 +50,11 @@ export type { AbstractWorker } from './worker/abstract-worker' export { ClusterWorker } from './worker/cluster-worker' export { ThreadWorker } from './worker/thread-worker' export { KillBehaviors } from './worker/worker-options' -export type { KillBehavior, WorkerOptions } from './worker/worker-options' +export type { + KillBehavior, + WorkerOptions, + KillHandler +} from './worker/worker-options' export type { TaskAsyncFunction, TaskFunction,