parallel-queue-flow fails with latest version of queue flow #2

Open
pk11 opened this Issue Apr 4, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@pk11

pk11 commented Apr 4, 2013

parallel-queue-flow : 0.1.4
queue-flow: 0.6.3

var q = require('queue-flow');
var fs = require('fs');
var parallel = require('parallel-queue-flow');


q(['.'], parallel(4))
    .node(fs.readdir, 'error')
    .flatten()
    .map(function(val, callback) {
      setTimeout(callback.bind(this, val), 20 * Math.floor(Math.random()*11));
    })
    .map(function(filename) {
        return ['./' + filename, 'utf8'];
    })
    .toArray(console.log)

fails with

/Users/phausel/workspace/beta/node_modules/parallel-queue-flow/lib/parallel-queue-flow.js:54
                    if(parallelQ.q.isAsync(handler, newArgs.length+1)) {
                                   ^
TypeError: Object function q(nameOrArray, qType) {
        if(typeof(nameOrArray) == "string") {
            if(!namedQueues[nameOrArray] || !(namedQueues[nameOrArray] instanceof q.defaultQ || namedQueues[nameOrArray] instanceof qType)) {
                namedQueues[nameOrArray] = new Q(nameOrArray, qType || q.defaultQ, q);
            }
            return namedQueues[nameOrArray];
        } else if(nameOrArray instanceof Array) {
            return new Q(nameOrArray, qType || q.defaultQ, q);
        } else {
            return new Q(undefined, qType || q.defaultQ, q);
        }
    } has no method 'isAsync'
    at Q.<anonymous> (/Users/phausel/workspace/beta/node_modules/parallel-queue-flow/lib/parallel-queue-flow.js:54:21)
    at Array.forEach (native)
    at Q.fire (/Users/phausel/workspace/beta/node_modules/parallel-queue-flow/lib/parallel-queue-flow.js:52:30)
    at Q.handlerCallback (/Users/phausel/workspace/beta/node_modules/parallel-queue-flow/lib/parallel-queue-flow.js:99:10)
    at Q.ercb (/Users/phausel/workspace/beta/node_modules/queue-flow/lib/queue-flow.js:525:9)
    at Object.oncomplete (fs.js:107:15)
@dfellis

This comment has been minimized.

Show comment Hide comment
@dfellis

dfellis Apr 4, 2013

Owner

Yes, 0.6.x's primary goals are to make queue-flow's code more legible, faster, and make it easier for alternate constructor functions (like parallel-queue-flow) to be written (less code needed, basically), so I'm keeping queue-flow's primary API (the various prototype methods) identical while cleaning up the internals a bit, but the alternate constructor functions have to know a bit about the internals to produce a constructor function that does the same job.

Basically, I forgot about the compatibility issues because we use npm shrinkwrap extensively at work and it shielded it from me.

Here are my steps to close this issue:

  • Immediately publish a revision of the current code that requires queue-flow@0.5.x
  • Modified parallel-queue-flow and sloppy-queue-flow to work with the altered internals and peg it to specific queue-flow versions
  • Once queue-flow 0.6.x's internals are stabilized, republish those future constructor functions to target >=0.6.y (y being the first API-stable version)
Owner

dfellis commented Apr 4, 2013

Yes, 0.6.x's primary goals are to make queue-flow's code more legible, faster, and make it easier for alternate constructor functions (like parallel-queue-flow) to be written (less code needed, basically), so I'm keeping queue-flow's primary API (the various prototype methods) identical while cleaning up the internals a bit, but the alternate constructor functions have to know a bit about the internals to produce a constructor function that does the same job.

Basically, I forgot about the compatibility issues because we use npm shrinkwrap extensively at work and it shielded it from me.

Here are my steps to close this issue:

  • Immediately publish a revision of the current code that requires queue-flow@0.5.x
  • Modified parallel-queue-flow and sloppy-queue-flow to work with the altered internals and peg it to specific queue-flow versions
  • Once queue-flow 0.6.x's internals are stabilized, republish those future constructor functions to target >=0.6.y (y being the first API-stable version)

dfellis pushed a commit that referenced this issue Apr 9, 2013

@dfellis

This comment has been minimized.

Show comment Hide comment
@dfellis

dfellis Apr 9, 2013

Owner

Alright, won't be able to close this for a little while, now, but the majority of this issue should be fixed. sloppy-queue-flow and parallel-queue-flow work with queue-flow@0.6.5 :)

Owner

dfellis commented Apr 9, 2013

Alright, won't be able to close this for a little while, now, but the majority of this issue should be fixed. sloppy-queue-flow and parallel-queue-flow work with queue-flow@0.6.5 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment