Skip to content

Commit

Permalink
Resolved bug with local get (#1995)
Browse files Browse the repository at this point in the history
  • Loading branch information
djordjekovac authored Aug 5, 2022
1 parent 69bfa17 commit 8e083f3
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/commands/protocols/get/sender/local-get-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ class LocalGetCommand extends Command {
* @param command
*/
async execute(command) {
const { operationId, assertionId } = command.data;
const {operationId, assertionId} = command.data;
await this.operationIdService.updateOperationIdStatus(
operationId,
OPERATION_ID_STATUS.GET.GET_LOCAL_START,
);
const assertionExists = await this.tripleStoreModuleManager.assertionExists(`assertion:${assertionId}`);
if (assertionExists) {
const nquads = await this.getService.localGet(assertionId, operationId);

const assertion = await this.getService.localGet(assertionId, operationId);
if (nquads.length) {
await this.operationIdService.cacheOperationIdData(operationId, nquads);
await this.operationIdService.updateOperationIdStatus(
operationId,
OPERATION_ID_STATUS.GET.GET_LOCAL_END,
);
await this.operationIdService.updateOperationIdStatus(
operationId,
OPERATION_ID_STATUS.GET.GET_END,
);
await this.operationIdService.updateOperationIdStatus(
operationId,
OPERATION_ID_STATUS.COMPLETED,
);

if (assertion.length) {
await this.operationIdService.cacheOperationIdData(operationId, {
assertion,
});
await this.operationIdService.updateOperationIdStatus(
operationId,
OPERATION_ID_STATUS.GET.GET_LOCAL_END,
);
await this.operationIdService.updateOperationIdStatus(
operationId,
OPERATION_ID_STATUS.GET.GET_END,
);
await this.operationIdService.updateOperationIdStatus(
operationId,
OPERATION_ID_STATUS.COMPLETED,
);

return Command.empty();
return Command.empty();
}
}

await this.operationIdService.updateOperationIdStatus(
Expand Down

0 comments on commit 8e083f3

Please sign in to comment.