fix: Remove locking from the SparqlUpdatePatchHandler

Due to not having re-entrant locks this would cause deadlocks
with the LockingResourceStore or require more advanced configurations.
If this is needed in the future we can potentially add a LockingPatchHandler.
This commit is contained in:
Joachim Van Herwegen
2021-01-20 11:34:42 +01:00
parent b59357ec30
commit 077f5d7069
2 changed files with 7 additions and 50 deletions

View File

@@ -11,7 +11,6 @@ import { getLoggerFor } from '../../logging/LogUtil';
import { INTERNAL_QUADS } from '../../util/ContentTypes';
import { NotFoundHttpError } from '../../util/errors/NotFoundHttpError';
import { NotImplementedHttpError } from '../../util/errors/NotImplementedHttpError';
import type { ResourceLocker } from '../../util/locking/ResourceLocker';
import type { ResourceStore } from '../ResourceStore';
import { PatchHandler } from './PatchHandler';
@@ -23,12 +22,10 @@ export class SparqlUpdatePatchHandler extends PatchHandler {
protected readonly logger = getLoggerFor(this);
private readonly source: ResourceStore;
private readonly locker: ResourceLocker;
public constructor(source: ResourceStore, locker: ResourceLocker) {
public constructor(source: ResourceStore) {
super();
this.source = source;
this.locker = locker;
}
public async canHandle(input: {identifier: ResourceIdentifier; patch: SparqlUpdatePatch}): Promise<void> {
@@ -43,12 +40,7 @@ export class SparqlUpdatePatchHandler extends PatchHandler {
const op = patch.algebra;
this.validateUpdate(op);
const lock = await this.locker.acquire(identifier);
try {
await this.applyPatch(identifier, op);
} finally {
await lock.release();
}
await this.applyPatch(identifier, op);
}
private isDeleteInsert(op: Algebra.Operation): op is Algebra.DeleteInsert {