arangodb/arangojs

retryOnConflict setting doesn't work

JakubC-projects opened this issue · 2 comments

I've been trying to use retryOnConflict setting but it doesn't work for me.
node version: v14.20.0
arangojs version: 7.8.0
arangoDB version: 3.8.6

POC:

const { Database } = require('arangojs');
const { aql } = require("arangojs/aql");

const db = new Database({
    databaseName: 'TEST_DB',
    agentOptions: {
        maxSockets: 10,
    },
})
db.useBasicAuth('root', 'root');

const query = aql`
    for t in TEST_COL
    filter t._key == "1"
    update t with {
        age: 2
    } in TEST_COL`


async function runTest() {
    const promises = []
    for(let i = 0; i < 10; i++) {
        promises.push(db.query(query, {retryOnConflict: 10}))
    }
    await Promise.all(promises);
    console.log("Completed successfully")
}

runTest()

Running this code results in: (node:31053) UnhandledPromiseRejectionWarning: ArangoError: AQL: write-write conflict (while executing)

According to my understanding having the retryOnconflict set to 10 should make the error disappear.

@JakubC-projects Can you check if this issue persists in 8.0.0-rc.1? I had to switch around some of the internals of how requests are processed and this may have solved this.

I've manually confirmed that this error occurs in 7.8.0 but not 8.0.0-rc.1. I'm closing this as fixed. If you can replicate this behavior in 8.0.0-rc.1 or later, please feel free to reopen this issue.