Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Push freezes if the handler is called in process.nextTick() #18

Closed
natesilva opened this Issue · 2 comments

2 participants

@natesilva

To reproduce: Take the example app shown on the pushover home page, and on line 19 simply wrap the handler in a process.nextTick():

// …
// [example app from pushover home page; first part is the same]
// …
var http = require('http');
var server = http.createServer(function (req, res) {
    process.nextTick(function() {
        repos.handle(req, res);
    });
});
server.listen(7005);

Run the app and push a repo to it.

Result: Starts to push, then hangs.

Not all requests hang, but a push often does.

This is preventing me from implementing auth. For example, if I auth to a database, the repos.handle method will get called later after some I/O has been done—equivalent to process.nextTick().

@juliangruber

Could you try

var server = http.createServer(function (req, res) {
    req.pause();
    process.nextTick(function() {
        repos.handle(req, res);
        req.resume();
    });
});
@natesilva

@juliangruber Thanks, that works. Looks like I have to read up some more on streams and pause()/resume().

@natesilva natesilva closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.