Skip to content

Commit

Permalink
fix: list items lock race (#7133)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom <[email protected]>
  • Loading branch information
bxb100 and ttalty authored Dec 15, 2023
1 parent 4d5c955 commit 6199e58
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/cli/src/commands/list.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,17 @@ export class ListCommand {
ciphers = this.searchService.searchCiphersBasic(ciphers, options.search, options.trash);
}

ciphers.forEach((c, index) => {
for (let i = 0; i < ciphers.length; i++) {
const c = ciphers[i];
// Set upload immediately on the last item in the ciphers collection to avoid the event collection
// service from uploading each time.
this.eventCollectionService.collect(
await this.eventCollectionService.collect(
EventType.Cipher_ClientViewed,
c.id,
index === ciphers.length - 1,
i === ciphers.length - 1,
c.organizationId,
);
});
}

const res = new ListResponse(ciphers.map((o) => new CipherResponse(o)));
return Response.success(res);
Expand Down

0 comments on commit 6199e58

Please sign in to comment.