GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix flaky test-http-set-timeout-server · nodejs/node@cd98f5d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http-set-timeout-server.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http-set-timeout-server.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-set-timeout-server.js
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,25 @@ test(function serverRequestNotTimeoutAfterEnd(cb) {
117117

118118
test(function serverResponseTimeoutWithPipeline(cb) {
119119
let caughtTimeout = '';
120+
let secReceived = false;
120121
process.on('exit', function() {
121122
assert.strictEqual(caughtTimeout, '/2');
122123
});
123124
const server = http.createServer(function(req, res) {
125+
if (req.url === '/2')
126+
secReceived = true;
124127
const s = res.setTimeout(50, function() {
125128
caughtTimeout += req.url;
126129
});
127130
assert.ok(s instanceof http.OutgoingMessage);
128131
if (req.url === '/1') res.end();
129132
});
130133
server.on('timeout', function(socket) {
131-
socket.destroy();
132-
server.close();
133-
cb();
134+
if (secReceived) {
135+
socket.destroy();
136+
server.close();
137+
cb();
138+
}
134139
});
135140
server.listen(common.mustCall(function() {
136141
const port = server.address().port;

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.