mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Fixed the duplicate notifications
This commit is contained in:
parent
913197ac18
commit
062ba2419b
7 changed files with 49 additions and 51 deletions
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Quartz;
|
||||
using Quartz.Impl;
|
||||
|
@ -15,6 +16,8 @@ namespace Ombi.Helpers
|
|||
|
||||
public static IScheduler Scheduler => Instance._scheduler;
|
||||
|
||||
private static SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
|
||||
|
||||
// Singleton
|
||||
protected static OmbiQuartz _instance;
|
||||
|
||||
|
@ -84,10 +87,20 @@ namespace Ombi.Helpers
|
|||
|
||||
public static async Task TriggerJob(string jobName, string group)
|
||||
{
|
||||
if (!(await IsJobRunning(jobName)))
|
||||
await _semaphore.WaitAsync();
|
||||
|
||||
try
|
||||
{
|
||||
await Scheduler.TriggerJob(new JobKey(jobName, group));
|
||||
if (!(await IsJobRunning(jobName)))
|
||||
{
|
||||
await Scheduler.TriggerJob(new JobKey(jobName, group));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_semaphore.Release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Ombi.Core.Settings;
|
||||
using Ombi.Settings.Settings.Models;
|
||||
using Ombi.Store.Entities.Requests;
|
||||
|
@ -31,7 +32,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|||
|
||||
var today = DateTime.UtcNow.Date;
|
||||
|
||||
var resolved = _issuesRepository.GetAll().Where(x => x.Status == IssueStatus.Resolved);
|
||||
var resolved = await _issuesRepository.GetAll().Where(x => x.Status == IssueStatus.Resolved).ToListAsync();
|
||||
var toDelete = resolved.Where(x => x.ResovledDate.HasValue && (today - x.ResovledDate.Value.Date).TotalDays >= settings.DaysAfterResolvedToDelete);
|
||||
|
||||
foreach (var d in toDelete)
|
||||
|
|
|
@ -115,34 +115,13 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
|
||||
if ((processedContent?.HasProcessedContent ?? false) && recentlyAddedSearch)
|
||||
{
|
||||
// Ensure it's not already running
|
||||
if (await OmbiQuartz.IsJobRunning(nameof(IPlexAvailabilityChecker)))
|
||||
{
|
||||
Logger.LogInformation("Availability checker already running");
|
||||
}
|
||||
else
|
||||
{
|
||||
await NotifyClient("Plex Sync - Checking if any requests are now available");
|
||||
Logger.LogInformation("Kicking off Plex Availability Checker");
|
||||
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
||||
}
|
||||
}
|
||||
|
||||
if ((processedContent?.HasProcessedContent ?? false) && recentlyAddedSearch)
|
||||
{
|
||||
// Ensure it's not already running
|
||||
if (await OmbiQuartz.IsJobRunning(nameof(IPlexAvailabilityChecker)))
|
||||
{
|
||||
Logger.LogInformation("Availability checker already running");
|
||||
}
|
||||
else
|
||||
{
|
||||
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
||||
}
|
||||
await NotifyClient("Plex Sync - Checking if any requests are now available");
|
||||
Logger.LogInformation("Kicking off Plex Availability Checker");
|
||||
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
||||
}
|
||||
var processedCont = processedContent?.Content?.Count() ?? 0;
|
||||
var processedEp = processedContent?.Episodes?.Count() ?? 0;
|
||||
Logger.LogInformation("Finished Plex Content Cacher, with processed content: {0}, episodes: {1}. Recently Added Scan: {2}", processedContent, processedEp, recentlyAddedSearch);
|
||||
Logger.LogInformation("Finished Plex Content Cacher, with processed content: {0}, episodes: {1}. Recently Added Scan: {2}", processedCont, processedEp, recentlyAddedSearch);
|
||||
|
||||
await NotifyClient(recentlyAddedSearch ? $"Plex Recently Added Sync Finished, We processed {processedCont}, and {processedEp} Episodes" : "Plex Content Sync Finished");
|
||||
|
||||
|
|
|
@ -76,14 +76,14 @@
|
|||
<div class="col-12 col-md-2">
|
||||
<mat-card class="mat-elevation-z8 spacing-below" *ngIf="isAdmin && movieRequest" [ngStyle]="{'display': showAdvanced ? '' : 'none' }">
|
||||
<mat-card-content class="medium-font">
|
||||
<movie-admin-panel [movie]="movieRequest" (radarrEnabledChange)="showAdvanced = $event" (advancedOptionsChange)="setAdvancedOptions($event)">
|
||||
<movie-admin-panel [movie]="movieRequest" (radarrEnabledChange)="showAdvanced = $event" (advancedOptionsChanged)="setAdvancedOptions($event)">
|
||||
</movie-admin-panel>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
<mat-card class="mat-elevation-z8">
|
||||
<mat-card-content class="medium-font">
|
||||
<movie-information-panel [movie]="movie" [advancedOptions]="advancedOptions"></movie-information-panel>
|
||||
<movie-information-panel [movie]="movie" [request]="movieRequest"></movie-information-panel>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
|
|
|
@ -33,14 +33,13 @@ export class MovieDetailsComponent {
|
|||
public messageService: MessageService, private auth: AuthService,
|
||||
private storage: StorageService) {
|
||||
this.route.params.subscribe((params: any) => {
|
||||
debugger;
|
||||
if (typeof params.movieDbId === 'string' || params.movieDbId instanceof String) {
|
||||
if (params.movieDbId.startsWith("tt")) {
|
||||
this.imdbId = params.movieDbId;
|
||||
}
|
||||
if (typeof params.movieDbId === 'string' || params.movieDbId instanceof String) {
|
||||
if (params.movieDbId.startsWith("tt")) {
|
||||
this.imdbId = params.movieDbId;
|
||||
}
|
||||
this.theMovidDbId = params.movieDbId;
|
||||
this.load();
|
||||
}
|
||||
this.theMovidDbId = params.movieDbId;
|
||||
this.load();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -97,22 +96,22 @@ export class MovieDetailsComponent {
|
|||
public async deny() {
|
||||
const dialogRef = this.dialog.open(DenyDialogComponent, {
|
||||
width: '250px',
|
||||
data: {requestId: this.movieRequest.id, requestType: RequestType.movie}
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
data: { requestId: this.movieRequest.id, requestType: RequestType.movie }
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
this.movieRequest.denied = result;
|
||||
if(this.movieRequest.denied) {
|
||||
if (this.movieRequest.denied) {
|
||||
this.movie.approved = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public async issue() {
|
||||
const dialogRef = this.dialog.open(NewIssueComponent, {
|
||||
width: '500px',
|
||||
data: {requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, providerId: this.movie.imdbId ? this.movie.imdbId : this.movie.id, title: this.movie.title}
|
||||
});
|
||||
data: { requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, providerId: this.movie.imdbId ? this.movie.imdbId : this.movie.id, title: this.movie.title }
|
||||
});
|
||||
}
|
||||
|
||||
public async approve() {
|
||||
|
@ -126,7 +125,7 @@ export class MovieDetailsComponent {
|
|||
}
|
||||
|
||||
public async markAvailable() {
|
||||
const result = await this.requestService.markMovieAvailable({id: this.movieRequest.id}).toPromise();
|
||||
const result = await this.requestService.markMovieAvailable({ id: this.movieRequest.id }).toPromise();
|
||||
if (result.result) {
|
||||
this.movie.available = true;
|
||||
this.messageService.send(result.message, "Ok");
|
||||
|
@ -135,7 +134,13 @@ export class MovieDetailsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
public setAdvancedOptions(data: any) {
|
||||
public setAdvancedOptions(data: IAdvancedData) {
|
||||
this.advancedOptions = data;
|
||||
if (data.rootFolderId) {
|
||||
this.movieRequest.qualityOverrideTitle = data.rootFolders.filter(x => x.id == data.rootFolderId)[0].path;
|
||||
}
|
||||
if (data.profileId) {
|
||||
this.movieRequest.rootPathOverrideTitle = data.profiles.filter(x => x.id == data.profileId)[0].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
<div *ngIf="advancedOptions">
|
||||
<strong>{{'MediaDetails.RootFolderOverride' | translate }}</strong>
|
||||
<div>{{advancedOptions.rootFolder.path}}</div>
|
||||
<div>{{request.rootPathOverrideTitle}}</div>
|
||||
</div>
|
||||
<div *ngIf="advancedOptions">
|
||||
<strong>{{'MediaDetails.QualityOverride' | translate }}</strong>
|
||||
<div>{{advancedOptions.profile.name}}</div>
|
||||
<div>{{request.qualityOverrideTitle}}</div>
|
||||
</div>
|
||||
<br />
|
||||
<div *ngIf="movie.genres">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, ViewEncapsulation, Input } from "@angular/core";
|
||||
import { ISearchMovieResultV2 } from "../../../../interfaces/ISearchMovieResultV2";
|
||||
import { IAdvancedData } from "../../../../interfaces";
|
||||
import { IAdvancedData, IMovieRequests } from "../../../../interfaces";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./movie-information-panel.component.html",
|
||||
|
@ -10,5 +10,5 @@ import { IAdvancedData } from "../../../../interfaces";
|
|||
})
|
||||
export class MovieInformationPanelComponent {
|
||||
@Input() public movie: ISearchMovieResultV2;
|
||||
@Input() public advancedOptions: IAdvancedData;
|
||||
@Input() public request: IMovieRequests;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue