"Test now" button

This commit is contained in:
2022-07-22 14:40:31 +02:00
parent af17f80fe1
commit 232c8a73d5
3 changed files with 45 additions and 3 deletions

View File

@ -2,13 +2,17 @@
const { makeId } = require('core/makeid');
async function processOutage({ outage, server, settings }) {
async function processOutage({ outage, server, settings, onDateUpdated }) {
if (typeof onDateUpdated !== 'function') {
onDateUpdated = () => null;
}
for (const [ id, testResult ] of Object.entries(outage)) {
// Update check date
server.storage.store('smartyellow/webservice').update(
{ id },
{ $set: { lastChecked: new Date() } }
);
).then(() => onDateUpdated(id));
// Get service entry
const service = await server