From d67ec571c5950f04b85f5a268b38eb026a156320 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Thu, 2 Jan 2025 15:46:57 +0100 Subject: [PATCH] fix: prevent TypeORM subscribers from calling itself over and over (#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. --- server/entity/MediaRequest.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index a01ab3c07..60da11764 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -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);