Skip to content
This repository was archived by the owner on Oct 31, 2018. It is now read-only.
This repository was archived by the owner on Oct 31, 2018. It is now read-only.

Concurrency in this.queue() #31

@vsukhomlinov

Description

@vsukhomlinov

Multiple queue() calls within the es.through() handler get sent downstream in wrong order:

var es = require('event-stream');

var streamLine = es.through(function (line) {
    this.queue("*");
    this.queue("|"+line+'\n');
});

process.stdin.on('readable', function() {
    var streamLine1 = es.through(function (line) {
        this.queue('*');
        this.queue("|"+line+'\n');
    });

    process.stdin.pipe(es.split()).pipe(streamLine).pipe(process.stdout);
})

I'm testing it like this

$ printf "a\nb\n" | node pipeTest.js
*|a
*|b
**|
|

An interesting note is that calling streamLine1 from closure renders everything properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions