From b57a294042de33ec1626f5f0a84b06bb80ba1327 Mon Sep 17 00:00:00 2001 From: Bluefox Date: Thu, 30 May 2024 19:19:16 +0700 Subject: [PATCH] Corrected repo update if more than one repository (#2774) * Corrected repo update if more than one repository * Corrected repo update if more than one repository * Corrected repo update if more than one repository * Corrected repo update if more than one repository * Corrected repo update if more than one repository * clarify force update --------- Co-authored-by: foxriver76 --- packages/controller/src/main.ts | 46 +++++++++++++++------------------ 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/packages/controller/src/main.ts b/packages/controller/src/main.ts index b6f8db760..8e0df71a4 100644 --- a/packages/controller/src/main.ts +++ b/packages/controller/src/main.ts @@ -52,8 +52,7 @@ import { getHostObject, getDefaultNodeArgs, type HostInfo, - isAdapterEsmModule, - type RepositoryFile + isAdapterEsmModule } from '@iobroker/js-controller-common-db/tools'; import type { UpgradeArguments } from '@/lib/upgradeManager.js'; import { AdapterUpgradeManager } from '@/lib/adapterUpgradeManager.js'; @@ -2102,9 +2101,9 @@ async function processMessage(msg: ioBroker.SendableMessage): Promise= 30_000 ) { - result = currentRepo; - } else { - result = await tools.getRepositoryFileAsync( + const result = await tools.getRepositoryFileAsync( currentRepo.link, currentRepo.hash, - updateRepo, + forcedUpdate, currentRepo.json ); - changed = result.json && result.changed; - } - - // If repo was really changed - if (changed) { - currentRepo.json = result.json; - currentRepo.hash = result.hash || ''; - currentRepo.time = new Date().toISOString(); + // If repo was really changed + if (result?.json && result.changed) { + changed = true; + currentRepo.json = result.json; + currentRepo.hash = result.hash || ''; + currentRepo.time = new Date().toISOString(); + } } // Make sure, that time is stored too to prevent the frequent access to repo server @@ -2181,9 +2175,11 @@ async function processMessage(msg: ioBroker.SendableMessage): Promise