node-celery-ts icon indicating copy to clipboard operation
node-celery-ts copied to clipboard

Result.getResult() always called, even if NullBackend is used.

Open chrischen opened this issue 6 years ago • 2 comments

If not using a backend, calling Task.applyAsync() always throws an exception because getResult() is called when creating new Result();

chrischen avatar Apr 23 '19 06:04 chrischen

This is still relevant. Specifically, when using redis, this section is executed:

        this.subscriber = this.pool.get()
            .then((subscriber) => __awaiter(this, void 0, void 0, function* () {
            yield subscriber.psubscribe("celery-task-meta-*");
            subscriber.on("pmessage", (_, channel, message) => this.onMessage(channel, message));
            return subscriber;
        }));

in the backend.js file, which leads to a catastrophic crash, saying that:

/Users/artur.galstyan/Workspace/app-compass/node_modules/redis-parser/lib/parser.js:179
    return new ReplyError(string)
           ^
 
ReplyError: ERR Can't execute 'get': only (P|S)SUBSCRIBE / (P|S)UNSUBSCRIBE / PING / QUIT / RESET are allowed in this context
    at parseError (/Users/artur.galstyan/Workspace/app-compass/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/Users/artur.galstyan/Workspace/app-compass/node_modules/redis-parser/lib/parser.js:302:14) {
  command: { name: 'get', args: [ '34305df6-b26e-41d0-899c-9f4d901fa555' ] }
}

I tried to circumvent the usage of this code by not using the backend (which seemed reasonable to be since it can be undefined according to the constructor) but then I get the error that OP mentioned.

ArturGalstyan1 avatar Jul 03 '25 12:07 ArturGalstyan1

I'd love to take a PR here. I don't have any projects anymore that use this so I don't feel confident in testing changes

cwill747 avatar Jul 16 '25 18:07 cwill747