Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing Issues #27

Open
markandrus opened this issue Jul 25, 2013 · 0 comments
Open

Timing Issues #27

markandrus opened this issue Jul 25, 2013 · 0 comments

Comments

@markandrus
Copy link

Not sure where in the stack this issue originates at (be it jugglingdb-postgres or pg), but the following code

var User = require('./models.js').User,
    user = new User();

user.save();

throws

events.js:72
        throw er; // Unhandled 'error' event
              ^
error: invalid frontend message type 0
    at p.parseE (./node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:497:11)
    at p.parseMessage (./node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:357:17)
    at Socket.<anonymous> (./node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:84:22)
    at Socket.EventEmitter.emit (events.js:117:20)
    at Socket.<anonymous> (_stream_readable.js:736:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)

when run via node test.js. Delaying the call to user.save by a little bit works around this:

var User = require('./models.js').User,
    user = new User();

setTimeout(function() { user.save(); }, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant