From 7e131c7b95479db6db7e03bdc9b0be657aa42096 Mon Sep 17 00:00:00 2001 From: Saya Date: Sun, 22 Dec 2024 16:25:50 +0800 Subject: [PATCH] fix: fix http dont throw errors now --- src/concurrency/ConcurrencyServer.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/concurrency/ConcurrencyServer.ts b/src/concurrency/ConcurrencyServer.ts index eb8ed97..c3631fb 100644 --- a/src/concurrency/ConcurrencyServer.ts +++ b/src/concurrency/ConcurrencyServer.ts @@ -1,6 +1,5 @@ import { AddressInfo } from 'node:net'; import { ConcurrencyManager } from './ConcurrencyManager'; -import { once } from 'node:events'; import Http from 'node:http'; /** @@ -106,10 +105,8 @@ export class ConcurrencyServer { * Starts this server */ public start(): Promise { - return new Promise((resolve, reject) => { - this.server.listen(); - this.server.once('listening', () => resolve(this.info)) - this.server.once('error', reject) + return new Promise((resolve) => { + this.server.listen(0 , () => resolve(this.info)); }) } } \ No newline at end of file