Skip to content

Timing Issues #27

@markandrus

Description

@markandrus

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions