Closed vitalii-komenda closed 3 years ago
I have the following code that throws sometimes Timeout waiting to lock key Operation timed out: Timeout waiting to lock key
Timeout waiting to lock key Operation timed out: Timeout waiting to lock key
const tx = await db.beginTransaction({ write: [ 'relations', 'regionServices', ], }); const key = 'some-key'; await tx.step(() => db.query({ query: ` FOR node, rel IN 1..1 ANY @id relations REMOVE rel._key IN relations OPTIONS { ignoreErrors: true } `, bindVars: { id: `regionServices/${key}`, }, })); await tx.step(() => db.query({ query: `REMOVE @key IN @@collection OPTIONS { ignoreErrors: true }`, bindVars: { key: key, '@collection': 'regionServices', }, })); const collection = await arangodb.getCollection('regionServices'); await tx.step(() => collection.save({ name: key, _key: key }, { overwriteMode: 'update' })); await tx.commit();
Looks like after removing relations it locks the key and cannot insert same key anymore
Does this run in transaction? await tx.step(() => collection.save({ name: key, _key: key }, { overwriteMode: 'update' }));
await tx.step(() => collection.save({ name: key, _key: key }, { overwriteMode: 'update' }));
I have the following code that throws sometimes
Timeout waiting to lock key Operation timed out: Timeout waiting to lock key
Looks like after removing relations it locks the key and cannot insert same key anymore