Documents the main structure, that sends out emails for offline nodes

This commit is contained in:
rubo77 2016-07-24 13:36:56 +02:00
parent 7ab25d0491
commit 0435df2ef3

View file

@ -22,6 +22,9 @@ angular.module('ffffng')
) {
var MONITORING_STATE_MACS_CHUNK_SIZE = 100;
var MONITORING_MAILS_DB_BATCH_SIZE = 50;
/**
* Defines the intervals emails are sent if a node is offline
*/
var MONITORING_OFFLINE_MAILS_SCHEDULE = {
1: { amount: 3, unit: 'hours' },
2: { amount: 1, unit: 'days' },
@ -327,11 +330,20 @@ angular.module('ffffng')
);
}
/**
* sends one of three mails if a node is offline
* @param {moment} startTime the moment the job started
* @param {Number} mailNumber which of three mails
* @param {Function} callback gets all nodes that are offline
*/
function sendOfflineMails(startTime, mailNumber, callback) {
sendMonitoringMailsBatched(
'offline ' + mailNumber,
'monitoring-offline-' + mailNumber,
function (findBatchCallback) {
/**
* descriptive string that stores, which was the last mail type, stored in the database as last_status_mail_type
*/
var previousType =
mailNumber === 1
? 'monitoring-online-again'