0

I have trouble with event-stream in a pg callback. I was able to reduce it with this small piece of code:

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

var ar = ['dd','dd','aa'];
var s1 = es.readArray(ar);
var s2 = es.readArray(ar);

var k1 = s1.pipe(es.map(function(i,cb){console.log(i);cb()}));

pg.connect("______my_string_____",function(err, client,pgdone) {
  var k2 = s2.pipe(es.map(function(i,cb){console.log(i);cb()}));
  console.log(err);
  pgdone();
})

If i run that code, the assignment of k1 results in a display of the array, as expected. But the assignment of k2 does nothing, being the same piece of code.

I have updated everything with sudo npm update, here is my package.json

"JSONStream": "^0.10.0",
"async": "^0.9.0",
"codecov.io": "0.0.8",
"commander": "^2.7.1",
"debug": "^2.1.1",
"event-stream": "^3.3.0",
"express": "^4.12.3",
"fs": "0.0.2",
"istanbul": "^0.3.8",
"lru-cache": "^2.6.2",
"mkdirp": "^0.5.0",
"mocha-lcov-reporter": "0.0.2",
"nock": "^1.2.1",
"numeral": "^1.5.3",
"path": "^0.11.14",
"pg": "^4.3.0",
"plotly": "^1.0.2",
"progress": "^1.1.8",
"request": "^2.53.0",
"should": "^5.2.0"

Any idea ?

TheFive
  • 168
  • 1
  • 10
  • Maybe i don not understand well the Question. Do you mean that the value for k2, if you execute console.log(k2) below the variable assignation still the same? Or are you having another kind of problem? – ecarrizo May 22 '15 at 19:58
  • The output of the program is: dd dd aa null (for No Error). So i miss during the assignment of k2 the call of the console.log. – TheFive May 22 '15 at 20:04
  • I have tried to test it on a clean system (travis-ci), so i have created a small project with the test: https://github.com/TheFive/pg-es – TheFive May 23 '15 at 06:49

0 Answers0