Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
apmcodes opened this issue Jan 23, 2019 · 1 comment
Open

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

apmcodes opened this issue Jan 23, 2019 · 1 comment

Comments

@apmcodes
Copy link

apmcodes commented Jan 23, 2019

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
@apmcodes apmcodes changed the title Confused: Is Watch not allowed after Reserver? Confused: Is Watch not allowed after Reserve? Jan 23, 2019
@apmcodes apmcodes changed the title Confused: Is Watch not allowed after Reserve? Confused: Is Watch not allowed while in Reserve? Jan 23, 2019
@apmcodes
Copy link
Author

Seems as beanstalkd reserve is a blocking call, other commands such as watch/ ignore are hanging. Is there way to watch while the client is still in reserve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant