mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-10 07:50:29 -07:00
Tags subset fix
This commit is contained in:
parent
354b2aeabf
commit
b154da79c8
1 changed files with 9 additions and 5 deletions
|
|
@ -109,22 +109,26 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
|
|||
|
||||
let isSubset = true;
|
||||
|
||||
for (let i = 0; i < currentTags.length; i += 1) {
|
||||
if (!requiredTags.includes(currentTags[i])) {
|
||||
for (let i = 0; i < requiredTags.length; i += 1) {
|
||||
if (!currentTags.includes(requiredTags[i])) {
|
||||
isSubset = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// requiredTags needs to be subset of currentTags
|
||||
args.jobLog(`Current tags: ${currentTags}`);
|
||||
args.jobLog(`Required tags: ${requiredTags}`);
|
||||
args.jobLog(`Is Subset: ${isSubset}`);
|
||||
|
||||
if (isSubset) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
args.variables.queueTags = '';
|
||||
args.jobLog('Worker type and tags are subset of required tags');
|
||||
args.jobLog('Required tags are subset of current tags, continuing to next plugin.');
|
||||
} else {
|
||||
args.jobLog('Required tags are not subset of current tags, requeueing.');
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
args.variables.queueTags = requiredTags.join(',');
|
||||
args.jobLog('Worker type and tags are not subset of required tags,'
|
||||
+ ` requeueing with tags ${args.variables.queueTags}`);
|
||||
args.jobLog(`Requeueing with tags ${args.variables.queueTags}`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue