Skip to content

Commit

Permalink
fix race condition when loading board nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
uidp committed Sep 20, 2023
1 parent cb7bf6d commit 9a4dce6
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions apps/server/src/modules/board/repo/board-node.repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ export class BoardNodeRepo {
constructor(private readonly em: EntityManager) {}

async findById(id: EntityId): Promise<BoardNode> {
let entity = this.em.getUnitOfWork().getById<BoardNode>(BoardNode.name, id);
if (entity) {
return entity;
}

entity = await this.em.findOneOrFail(BoardNode, id);
const entity = await this.em.findOneOrFail(BoardNode, id);
return entity;
}

Expand Down

0 comments on commit 9a4dce6

Please sign in to comment.