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

es.map doesn't fire 'end' event? #68

Closed
kevzettler opened this Issue Jul 24, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@kevzettler

kevzettler commented Jul 24, 2014

I have a stream thats piped to es.map and it dosen't seem to fire end close or finish below is the map function.

function installFilterDataHandle(install, cb){
  var install_obj = JSON.parse(install);
  var origin_key = key_map[install_obj.api_key];

  if(!_.isUndefined(origin_key)){
    idfa_map[origin_key] = install_obj.om_idfa;
    cb(null,null);
  }
  cb(null, null);
}


  install_pipe = install_filter.stdout
              .pipe(es.split())
              .pipe(es.map(installFilterDataHandle));

  install_pipe.on('data', function(data){
    console.log("install pipe data",data);
  });

  install_pipe.on('end', function(){
    console.log('done mapping installs');
  });

  install_pipe.on('close', function(){
    console.log('done mapping installs');
  });

  install_pipe.on('finish', function(){
    console.log('done mapping installs');
  });
@dominictarr

This comment has been minimized.

Owner

dominictarr commented Jul 24, 2014

you are calling the cb twice (once inside the if and then after it) I wouldn't be surprised if you that breaks something - also: are you sure that install_filter is emitting end?

@kevzettler

This comment has been minimized.

kevzettler commented Jul 24, 2014

@dominictarr the install_filter is actually a child process grep I don't explicitly kill the child process is that prohibiting it from sending the end event?

@dominictarr

This comment has been minimized.

Owner

dominictarr commented Jul 25, 2014

well, the child process decides when to exit. it may also depend on the input to grep.
I doubt that the problem is map because loads of people have used event-stream for ages and no one has compliained about this. I'd add an install_filter.on('end', ...) and some logging because that is my bet.

@kevzettler kevzettler closed this Jul 25, 2014

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