gofullstack / gearman-node

Gearman libraries for Node.js
MIT License
61 stars 10 forks source link

TypeError: Cannot use 'in' operator to search for 'encoding' in undefined #6

Open askie opened 10 years ago

askie commented 10 years ago

code:

var gearman = require("gearman"), client = gearman.createClient(4730, "my-gearman-server.example.com");

console.log("Sending job..."); var job = client.submitJob("reverse", "Hello World!", { encoding: "utf8" }); job.on("complete", function (data) { console.log(data); client.end(); });


sometime error bellow when do submitJob faster:

/home/jj/node_modules/gearman/lib/client/responses.js:9 if ("encoding" in job) { d = d.toString(job.encoding); } ^ TypeError: Cannot use 'in' operator to search for 'encoding' in undefined at Object.WORK_COMPLETE (/home/jj/node_modules/gearman/lib/client/responses.js:9:27) at Socket.Client.getConnection.connection (/home/jj/node_modules/gearman/lib/client.js:38:53) at Socket.EventEmitter.emit (events.js:96:17) at TCP.onread (net.js:397:14)


is that need a callback in gearman.createClient, and using callback to submitJob a job ?

smith commented 10 years ago

Which version of Node are you using? This project hasn't been updated in a long time (I'm no longer using it so no longer making updates) and it's possible that the latest release of this module doesn't work at all with newer releases of Node.