Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Question on connection.handlers #3

@jayyvis

Description

@jayyvis

Hi Ben Lund,

I am planning to use this library and I am having a question for you. I see that connection.handlers is an array and handlers[0] is used to process the data coming from beanstalkd and it's getting left shifted to bring the next available handler at index 0.

Why do we need to keep multiple handlers at the same time ? Does this mean, we shall issue multiple commands at the same time without waiting for the completion of previous one ?

say for eg.,

var client = require('beanstalk_client').Client;

client.connect('127.0.0.1:11300', function(err, conn) {

  conn.put(0, 0, 1, 'my job1', function(err, job_id) {
    console.log('put job: ' + job_id);
  });

  conn.put(0, 0, 1, 'my job2', function(err, job_id) {
    console.log('put job: ' + job_id);
  });

});

I had executed this code and see it works fine. But wanted to get clarified from you since both the operations are using the single connection at the same time. How does the operations gets synchronized ?

Could you help me out understand this case better ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions