Skip to content

Confused: Is Watch not allowed while in Reserve? #179

@apmcodes

Description

@apmcodes

Is WATCH not allowed while in RESERVE call? Is this the way beanstalkd works or is it fivebeans?

In the below code, first reserve command is run and then watch command after 2 secs, but watch command callback is never run.

consumer.js

var fivebeans = require('fivebeans');

var client = new fivebeans.client('127.0.0.1', 11300);
client
    .on('connect', function () {
        console.log('Connected');
    })
    .on('error', function (err) {
        // connection failure
    })
    .on('close', function () {
        // underlying connection has closed
    })
    .connect();

client.reserve(function (err, jobid, payload) {
    if (err) { console.log(err) }
    console.log(`Job Id ${jobid}`);
    console.log(`Job data ${payload.toString()}`);
    client.destroy(jobid, function (err) {
        if (err) { console.log(err) }
        console.log(`Job deleted ${jobid}`);
    });
});

setTimeout(() => {
    console.log('going to watch')
    client.watch('low-volume', (err, tubecount) => {
        console.log(err);
        console.log(tubecount);
    })
}, 2000)    

Output

Connetced
going to watch

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