Skip to content

Commit

Permalink
fix: prevent TypeORM subscribers from calling itself over and over (#…
Browse files Browse the repository at this point in the history
…1215)

When a series is requested, an event is triggered by TypeORM after the request status has been
updated. The function executed by this event updated the request status to "PROCESSING", even if the
request already had this status. This triggered the same function once again, which repeated the
update, in an endless loop.
  • Loading branch information
gauthier-th authored Jan 2, 2025
1 parent f3ebf60 commit d67ec57
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/entity/MediaRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,8 @@ export class MediaRequest {
// Do not update the status if the item is already partially available or available
media[this.is4k ? 'status4k' : 'status'] !== MediaStatus.AVAILABLE &&
media[this.is4k ? 'status4k' : 'status'] !==
MediaStatus.PARTIALLY_AVAILABLE
MediaStatus.PARTIALLY_AVAILABLE &&
media[this.is4k ? 'status4k' : 'status'] !== MediaStatus.PROCESSING
) {
media[this.is4k ? 'status4k' : 'status'] = MediaStatus.PROCESSING;
mediaRepository.save(media);
Expand Down

0 comments on commit d67ec57

Please sign in to comment.