Code Monkey home page Code Monkey logo

node-beanstalkd-worker's People

Contributors

demiand avatar mickhansen avatar sushantdhiman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-beanstalkd-worker's Issues

Clearer description

Hi,

This project is great but I skipped it numerous times while searching for a decent beanstalkd client, because I thought this was only for the job consumer (worker) side. In fact, this can actually put jobs in the queue, so generally speaking it is more than a worker. It's both a job producer and consumer, but I didn't realize that.

Please consider improving the description of the project, to show that it covers the whole producer-consumer cycle. I think more people would use it then.

Thanks

What does "width" means?

The readme says this:

Keep in mind that worker will spawn a connection equal to width * amount of tubes

Would you mind elaborating what "width" is?

data without "payload" property

Hi. Is There a way to add the job data without the property "payload" ? This makes it possibly incompatible if you want to use this library together with others that puts data objects ( or pure strings ? ) directly to the job contents.

If I spawn a job with the lib it looks like this:

{
    "payload":{
        "ax":"xyz"
    }
}

but I expect it like this:

{
     "ax":"xyz"
}

Code is from your example:

worker.spawn(tube, {
  ax: "xyz" // job payload/values
}, {
  delay: 0,
  priority: 1000,
  timeout: 10 * 60 * 1000 // ms
}).then(function (job) {
  console.log(job.id);
});

TypeError: Cannot read property '_reject' of undefined

Hi, I'm getting this error a couple of minutes after successfully starting a worker process:

/home/me/node_modules/bluebird/js/main/promise.js:783
        promise._reject(value, carriedStackTrace);
                ^

TypeError: Cannot read property '_reject' of undefined
    at Promise._settlePromiseAt (/home/me/node_modules/bluebird/js/main/promise.js:783:17)
    at Promise._settlePromises (/home/me/node_modules/bluebird/js/main/promise.js:884:14)
    at Async._drainQueue (/home/me/node_modules/bluebird/js/main/async.js:98:12)
    at Async._drainQueues (/home/me/node_modules/bluebird/js/main/async.js:103:10)
    at Async.drainQueues (/home/me/node_modules/bluebird/js/main/async.js:37:14)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

I'm running a simple worker process in a docker image: FROM node:8.8-alpine.

Should worker.start() create a looped process?

My setup is about as simple as it could be, but I can't figure out how to keep a worker process running. I've dug into the source code looking for some kind of keepalive and haven't seen anything, and as far as I can tell, the loop function should be running.

Here is my code:

const queue = new BeanstalkdWorker(config.beanstalkd.host, config.beanstalkd.port),

// ----------------------- WEB APP -----------------------

async function run(project) {
	const job = await queue.spawn(`validation`, project)

	return {id: job.id}
}

export default run

// ----------------------- WORKER -----------------------

const COMMAND = `node ${__filename}`
const IS_WORKER = `${process.argv0} ${process.argv.slice(1).join(` `)}` === COMMAND

if (IS_WORKER) {
	queue.handle(`validation`, project => Promise.resolve(validate(project)))
	queue.start()
}

And here is the output from DEBUG=* node ./validate.js

  beanstalkd-worker:validation Starting watchers +0ms
  beanstalkd connecting to 127.0.0.1:11300 +0ms
  beanstalkd connected to 127.0.0.1:11300 +326ms
  beanstalkd Sent command "watch validation" +11ms
  beanstalkd Sent command "ignore default" +2ms
  beanstalkd-worker:validation Reserving job, timeout: 30000 +341ms

After the "Reserving job" debug output, the process ends. Any suggestions would be great, thanks for your time!

[feature] client does not handle disconnects

Moving from wrong repo burstable/node-beanstalkd-client#6

Description

This client currently does not handle disconnects, be it just a network error or the complete node fails.

Expectation

Either throw on connection failure or reconnect.

Current behaviour

it breaks completely, every subsequent request just throws errors that it can't connect to the server even though it is running again. Only restarting the application helps.

so once i make a call and no server is available it first throws errors and after that it wont stop throwing on subsequent request. If I however do not make a request while the server is down and it is back available again before the next, for some strange reasons everything works.

We talk by the way about spawning, the handler just silently dies and does nothing anymore forever.

Rejecting promise in handle creates unhandled error

The following code results in (node:18780) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): undefined when validate(data) throws an error. It's running in Node v8.1.4.

worker.handle(`validation`, data => {
	return new Promise(res => {
		res(validate(data))
	})
})

Because the worker is expecting either a resolved or rejected Promise, my assumption would be that rejected promises are handled by the library and registered as failures. If that's not the case, where should these rejections be managed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.