mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 18:25:54 -07:00
Merge pull request #647 from HaveAGitGat/hc
Flow Run Health Check updates stats and queues
This commit is contained in:
commit
f8ee3169f3
3 changed files with 24 additions and 1 deletions
|
|
@ -126,10 +126,20 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
return [4 /*yield*/, cli.runCli()];
|
return [4 /*yield*/, cli.runCli()];
|
||||||
case 1:
|
case 1:
|
||||||
res = _a.sent();
|
res = _a.sent();
|
||||||
|
if (!(typeof args.updateStat !== 'undefined')) return [3 /*break*/, 3];
|
||||||
|
return [4 /*yield*/, args.updateStat(args.originalLibraryFile.DB, 'totalHealthCheckCount', 1)];
|
||||||
|
case 2:
|
||||||
|
_a.sent();
|
||||||
|
_a.label = 3;
|
||||||
|
case 3:
|
||||||
if (res.cliExitCode !== 0) {
|
if (res.cliExitCode !== 0) {
|
||||||
args.jobLog('Running CLI failed');
|
args.jobLog('Running CLI failed');
|
||||||
|
args.logOutcome('hErr');
|
||||||
throw new Error('Running CLI failed');
|
throw new Error('Running CLI failed');
|
||||||
}
|
}
|
||||||
|
args.logOutcome('hSuc');
|
||||||
|
// will cause item to go into the health check success table
|
||||||
|
args.variables.healthCheck = 'Success';
|
||||||
return [2 /*return*/, {
|
return [2 /*return*/, {
|
||||||
outputFileObj: args.inputFileObj,
|
outputFileObj: args.inputFileObj,
|
||||||
outputNumber: 1,
|
outputNumber: 1,
|
||||||
|
|
|
||||||
|
|
@ -97,11 +97,22 @@ const plugin = async (args:IpluginInputArgs):Promise<IpluginOutputArgs> => {
|
||||||
|
|
||||||
const res = await cli.runCli();
|
const res = await cli.runCli();
|
||||||
|
|
||||||
|
// Added in 2.19.01
|
||||||
|
if (typeof args.updateStat !== 'undefined') {
|
||||||
|
await args.updateStat(args.originalLibraryFile.DB, 'totalHealthCheckCount', 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (res.cliExitCode !== 0) {
|
if (res.cliExitCode !== 0) {
|
||||||
args.jobLog('Running CLI failed');
|
args.jobLog('Running CLI failed');
|
||||||
|
args.logOutcome('hErr');
|
||||||
throw new Error('Running CLI failed');
|
throw new Error('Running CLI failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args.logOutcome('hSuc');
|
||||||
|
|
||||||
|
// will cause item to go into the health check success table
|
||||||
|
args.variables.healthCheck = 'Success';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
outputFileObj: args.inputFileObj,
|
outputFileObj: args.inputFileObj,
|
||||||
outputNumber: 1,
|
outputNumber: 1,
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ export interface Ivariables {
|
||||||
ffmpegCommand: IffmpegCommand,
|
ffmpegCommand: IffmpegCommand,
|
||||||
flowFailed: boolean,
|
flowFailed: boolean,
|
||||||
user: Record<string, string>,
|
user: Record<string, string>,
|
||||||
|
healthCheck?: 'Success',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IpluginOutputArgs {
|
export interface IpluginOutputArgs {
|
||||||
|
|
@ -137,7 +138,8 @@ export interface IpluginInputArgs {
|
||||||
updateWorker: IupdateWorker,
|
updateWorker: IupdateWorker,
|
||||||
logFullCliOutput: boolean,
|
logFullCliOutput: boolean,
|
||||||
logOutcome: (outcome: string) => void,
|
logOutcome: (outcome: string) => void,
|
||||||
scanIndividualFile?: (filee: IFileObjectMin, scanTypes: IscanTypes) => IFileObject,
|
scanIndividualFile?: (filee: IFileObjectMin, scanTypes: IscanTypes) => Promise<IFileObject>,
|
||||||
|
updateStat: (db: string, key: string, inc: number) => Promise<void>,
|
||||||
deps: {
|
deps: {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
fsextra: any,
|
fsextra: any,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue