Skip to content

Commit d630874

Browse files
addaleaxMylesBorins
authored andcommitted
test: speed up parallel/test-tls-session-cache
This test had some unnecessary timeouts that made it run for a much longer time than necessary (about 9 s rather than 0.2 s). PR-URL: #18424 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent ac41aac commit d630874

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/parallel/test-tls-session-cache.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ function doTest(testOptions, callback) {
6969
server.on('newSession', function(id, data, cb) {
7070
++newSessionCount;
7171
// Emulate asynchronous store
72-
setTimeout(function() {
72+
setImmediate(() => {
7373
assert.ok(!session);
7474
session = { id, data };
7575
cb();
76-
}, 1000);
76+
});
7777
});
7878
server.on('resumeSession', function(id, callback) {
7979
++resumeCount;
@@ -89,9 +89,9 @@ function doTest(testOptions, callback) {
8989
}
9090

9191
// Just to check that async really works there
92-
setTimeout(function() {
92+
setImmediate(() => {
9393
callback(null, data);
94-
}, 100);
94+
});
9595
});
9696

9797
server.listen(0, function() {
@@ -132,7 +132,7 @@ function doTest(testOptions, callback) {
132132
}
133133
assert.strictEqual(code, 0);
134134
server.close(common.mustCall(function() {
135-
setTimeout(callback, 100);
135+
setImmediate(callback);
136136
}));
137137
}));
138138
}

0 commit comments

Comments
 (0)