mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
fix: invalid monthly cron execution time
Note: did additional refactoring
This commit is contained in:
committed by
Rainer Killinger
parent
80e62496f0
commit
7a9f3eaca4
@@ -61,7 +61,7 @@ function minConditionFails(minimumLength: number, total: number) {
|
|||||||
* @param total Number of results
|
* @param total Number of results
|
||||||
*/
|
*/
|
||||||
function maxConditionFails(maximumLength: number, total: number) {
|
function maxConditionFails(maximumLength: number, total: number) {
|
||||||
return typeof maximumLength === 'number' && maximumLength < total;
|
return maximumLength < total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +72,7 @@ function maxConditionFails(maximumLength: number, total: number) {
|
|||||||
* @param total total number of results of the query
|
* @param total total number of results of the query
|
||||||
* @param mailQueue mailQueue to execute mail actions
|
* @param mailQueue mailQueue to execute mail actions
|
||||||
*/
|
*/
|
||||||
export function runActions(
|
function runActions(
|
||||||
actions: Array<SCMonitoringLogAction | SCMonitoringMailAction>,
|
actions: Array<SCMonitoringLogAction | SCMonitoringMailAction>,
|
||||||
watcherName: string,
|
watcherName: string,
|
||||||
triggerName: string,
|
triggerName: string,
|
||||||
@@ -104,7 +104,7 @@ export function runActions(
|
|||||||
* @param esClient elasticsearch client
|
* @param esClient elasticsearch client
|
||||||
* @param mailQueue mailQueue for mail actions
|
* @param mailQueue mailQueue for mail actions
|
||||||
*/
|
*/
|
||||||
export function setUp(monitoringConfig: SCMonitoringConfiguration, esClient: Client, mailQueue: MailQueue) {
|
export async function setUp(monitoringConfig: SCMonitoringConfiguration, esClient: Client, mailQueue: MailQueue) {
|
||||||
|
|
||||||
// set up Watches
|
// set up Watches
|
||||||
monitoringConfig.watchers.forEach((watcher) => {
|
monitoringConfig.watchers.forEach((watcher) => {
|
||||||
@@ -122,7 +122,7 @@ export function setUp(monitoringConfig: SCMonitoringConfiguration, esClient: Cli
|
|||||||
trigger.executionTime = '5 0 * * 0';
|
trigger.executionTime = '5 0 * * 0';
|
||||||
break;
|
break;
|
||||||
case 'monthly':
|
case 'monthly':
|
||||||
trigger.executionTime = '5 0 * 0 * *';
|
trigger.executionTime = '5 0 1 * *';
|
||||||
}
|
}
|
||||||
|
|
||||||
cron.schedule(trigger.executionTime, async () => {
|
cron.schedule(trigger.executionTime, async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user