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 ?