mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -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;
|
||||
|
||||
|
@ -83,12 +86,22 @@ namespace Ombi.Helpers
|
|||
}
|
||||
|
||||
public static async Task TriggerJob(string jobName, string group)
|
||||
{
|
||||
await _semaphore.WaitAsync();
|
||||
|
||||
try
|
||||
{
|
||||
if (!(await IsJobRunning(jobName)))
|
||||
{
|
||||
await Scheduler.TriggerJob(new JobKey(jobName, group));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_semaphore.Release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static async Task TriggerJob(string jobName, string group, IDictionary<string, object> data)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -114,35 +114,14 @@ 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");
|
||||
}
|
||||
}
|
||||
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,7 +33,6 @@ 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;
|
||||
|
@ -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