rethinkdb-ts icon indicating copy to clipboard operation
rethinkdb-ts copied to clipboard

ReqlDriverError: query cancelled

Open apeman76 opened this issue 8 months ago • 4 comments

I am having the same issue as https://github.com/rethinkdb/rethinkdb-ts/issues/8

I am closing the cursor of a changefeed using a connectPool

        // Connection pool options
        const options = {
            silent: true,
            host: "localhost",
            port: 28015,
            db: "mydb",
            buffer: 50,
        };

        await r.connectPool(options);
        console.log("RethinkDB connection pool established");

Then I create the cursor:

        cursor = await r.table("settings").get(userId).changes(changeOptions).run();

        cursor.each((err, change) => {
            if (err) {
                console.error(err);
                return;
            }
            if (change) {
                try {
                    emit("settings", JSON.stringify(change));
                } catch (e) {
                    console.error("Error emitting data:", e);
                }
            }
        });

and when I try to .close() it, it will produce the error:

RethinkDBError [ReqlDriverError]: Query cancelled in:
r.db("mydb").table("settings").get(

As you can see im already using silent as suggested in #8 but it still appears I have also tried log: (message: string) => {},

Changing https://github.com/rethinkdb/rethinkdb-ts/blob/9b9810dfb9a09283e0ab57d84edd631d2d936f53/src/connection/socket.ts#L182C18-L182C18 This line to if (data?.queue.length > 0) { does seem to solve the issue, but im no expert and this might be plain wrong.

Thanks in advance!

apeman76 avatar Dec 05 '23 19:12 apeman76

Does this code break an execution or it just logs this error out without breaking anything? There are some places in the library, which are logging an error without depending in the log function. I wanted to change that in v3 version of the lib, but have no time to proper test it and make a broad full changelog.

atassis avatar Dec 13 '23 11:12 atassis

Does this code break an execution or it just logs this error out without breaking anything? There are some places in the library, which are logging an error without depending in the log function. I wanted to change that in v3 version of the lib, but have no time to proper test it and make a broad full changelog.

It just logs the error, it doesn't seem to break anything

apeman76 avatar Dec 16 '23 18:12 apeman76

Ok, I thought so. Lib might just output an error caught internally. Does the fact it outputs bother you much?

atassis avatar Dec 16 '23 19:12 atassis

Ok, I thought so. Lib might just output an error caught internally. Does the fact it outputs bother you much?

Its not really a issue but if there was a quick fix to silence this specific error i'd take it :) i.e. if the if (data?.queue.length > 0) { doesnt break anything i'll leave that in for now

apeman76 avatar Dec 16 '23 20:12 apeman76