fix(request): mark request as approved if media is already available when retrying failed request (#3244)

pull/3247/head
Danshil Kokil Mungur 2 years ago committed by GitHub
parent 3aefddd488
commit cb650745f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -767,7 +767,16 @@ export class MediaRequest {
if ( if (
media[this.is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE media[this.is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE
) { ) {
throw new Error('Media already available'); logger.warn('Media already exists, marking request as APPROVED', {
label: 'Media Request',
requestId: this.id,
mediaId: this.media.id,
});
const requestRepository = getRepository(MediaRequest);
this.status = MediaRequestStatus.APPROVED;
await requestRepository.save(this);
return;
} }
const radarrMovieOptions: RadarrMovieOptions = { const radarrMovieOptions: RadarrMovieOptions = {
@ -908,7 +917,16 @@ export class MediaRequest {
if ( if (
media[this.is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE media[this.is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE
) { ) {
throw new Error('Media already available'); logger.warn('Media already exists, marking request as APPROVED', {
label: 'Media Request',
requestId: this.id,
mediaId: this.media.id,
});
const requestRepository = getRepository(MediaRequest);
this.status = MediaRequestStatus.APPROVED;
await requestRepository.save(this);
return;
} }
const tmdb = new TheMovieDb(); const tmdb = new TheMovieDb();

Loading…
Cancel
Save