button zum prüfen

This commit is contained in:
2025-11-17 21:57:03 +01:00
parent cad72232d9
commit ca81121f3d
5 changed files with 87 additions and 38 deletions

View File

@@ -5,6 +5,7 @@ const { DEFAULT_SETTINGS } = require('./adminConfig');
const notificationService = require('./notificationService');
const { readConfig, writeConfig } = require('./configStore');
const { readStoreWatch, writeStoreWatch } = require('./storeWatchStore');
const { setStoreStatus, persistStoreStatusCache } = require('./storeStatusCache');
function wait(ms) {
if (!ms || ms <= 0) {
@@ -428,6 +429,7 @@ async function checkWatchedStores(sessionId, settings = DEFAULT_SETTINGS, option
const perRequestDelay = Math.max(0, Number(settings?.storeWatchRequestDelayMs) || 0);
let changed = false;
let statusCacheUpdated = false;
const summary = [];
for (let index = 0; index < watchers.length; index += 1) {
const watcher = watchers[index];
@@ -449,6 +451,8 @@ async function checkWatchedStores(sessionId, settings = DEFAULT_SETTINGS, option
}
watcher.lastStatusCheckAt = checkedAt;
changed = true;
setStoreStatus(watcher.storeId, { teamSearchStatus: status, fetchedAt: checkedAt });
statusCacheUpdated = true;
summary.push({
storeId: watcher.storeId,
storeName: watcher.storeName,
@@ -477,6 +481,9 @@ async function checkWatchedStores(sessionId, settings = DEFAULT_SETTINGS, option
if (changed) {
writeStoreWatch(session.profile.id, watchers);
}
if (statusCacheUpdated) {
persistStoreStatusCache();
}
if (options.sendSummary && summary.length > 0) {
try {
await notificationService.sendStoreWatchSummaryNotification({