revert: "ci: try to fix request timeouts (#11183)" (#11184)

This commit is contained in:
jrandolf 2023-10-17 16:46:54 +02:00 committed by GitHub
parent 57dc357e90
commit 20ee325e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,6 @@ export class TestServer {
#csp = new Map<string, string>(); #csp = new Map<string, string>();
#gzipRoutes = new Set<string>(); #gzipRoutes = new Set<string>();
#requestSubscribers = new Map<string, Subscriber>(); #requestSubscribers = new Map<string, Subscriber>();
#requests = new Set<ServerResponse>();
static async create(dirPath: string): Promise<TestServer> { static async create(dirPath: string): Promise<TestServer> {
let res!: (value: unknown) => void; let res!: (value: unknown) => void;
@ -193,20 +192,12 @@ export class TestServer {
subscriber.reject.call(undefined, error); subscriber.reject.call(undefined, error);
} }
this.#requestSubscribers.clear(); this.#requestSubscribers.clear();
for (const request of this.#requests.values()) {
if (!request.writableEnded) {
request.end();
}
}
this.#requests.clear();
} }
#onRequest: RequestListener = ( #onRequest: RequestListener = (
request: TestIncomingMessage, request: TestIncomingMessage,
response response
): void => { ): void => {
this.#requests.add(response);
request.on('error', (error: {code: string}) => { request.on('error', (error: {code: string}) => {
if (error.code === 'ECONNRESET') { if (error.code === 'ECONNRESET') {
response.end(); response.end();