repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge dependabot/npm_and_yarn/examples/typescript/smtp-client-pool/poolifier-4.0...
[poolifier.git]
/
examples
/
typescript
/
http-server-pool
/
express-hybrid
/
src
/
main.ts
diff --git
a/examples/typescript/http-server-pool/express-hybrid/src/main.ts
b/examples/typescript/http-server-pool/express-hybrid/src/main.ts
index 08563f4b2e753cefa3a331e9d0193be2a809f526..69a329b6a9b3613b6da047af2786698f7e1134aa 100644
(file)
--- a/
examples/typescript/http-server-pool/express-hybrid/src/main.ts
+++ b/
examples/typescript/http-server-pool/express-hybrid/src/main.ts
@@
-1,6
+1,8
@@
import { dirname, extname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { dirname, extname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
-import { FixedClusterPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, FixedClusterPool } from 'poolifier'
+
import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js'
const expressWorkerFile = join(
import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js'
const expressWorkerFile = join(
@@
-17,6
+19,7
@@
const pool = new FixedClusterPool<ClusterWorkerData, ClusterWorkerResponse>(
availableParallelism(),
expressWorkerFile,
{
availableParallelism(),
expressWorkerFile,
{
+ enableEvents: false,
onlineHandler: () => {
pool
.execute({
onlineHandler: () => {
pool
.execute({
@@
-37,13
+40,12
@@
const pool = new FixedClusterPool<ClusterWorkerData, ClusterWorkerResponse>(
.then(response => {
if (response.status) {
console.info(
.then(response => {
if (response.status) {
console.info(
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
- `Express is listening in cluster worker on port ${response?.port}`
+ `Express is listening in cluster worker on port ${response.port}`
)
}
)
}
- return
null
+ return
undefined
})
})
- .catch(
error
=> {
+ .catch(
(error: unknown)
=> {
console.error('Express failed to start in cluster worker:', error)
})
},
console.error('Express failed to start in cluster worker:', error)
})
},