Skip to content

Commit

Permalink
prettier:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHellTower authored Oct 24, 2023
1 parent 6f30a6f commit f6213ea
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/renderer/managers/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,16 @@ export async function checkUpdate(id: string, verbose = true): Promise<void> {
}

const newVersion = res.manifest.version;
const versions = [ newVersion.split('.'), version.split('.') ];
const versions = [newVersion.split("."), version.split(".")];

if(newVersion !== version &&
(versions[0][0] > versions[1][0] ||
(versions[0][0] === versions[1][0] && versions[0][1] > versions[1][1]) ||
(versions[0][0] === versions[1][0] && versions[0][1] === versions[1][1] && versions[0][2] > versions[1][2])
)) {
if (
newVersion !== version &&
(versions[0][0] > versions[1][0] ||
(versions[0][0] === versions[1][0] && versions[0][1] > versions[1][1]) ||
(versions[0][0] === versions[1][0] &&
versions[0][1] === versions[1][1] &&
versions[0][2] > versions[1][2]))
) {
logger.log(`Entity ${id} has an update available`);
updaterState.set(id, {
available: true,
Expand Down Expand Up @@ -223,17 +226,17 @@ export async function checkAllUpdates(autoCheck = false, verbose = false): Promi

logger.log("Checking for updates");

const delay = (ms: number): Promise<void> => new Promise(resolve => setTimeout(resolve, ms));
const delay = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms));

async function checkUpdatesWithRateLimit(): Promise<void> {
await checkUpdate(REPLUGGED_ID, verbose);

for (const addon of addons) {
await checkUpdate(addon.manifest.id, verbose);
await delay(1000 / 15); // Delay for 1 second divided by 15 (15 requests per second)
}
}
}

await checkUpdatesWithRateLimit();

logger.log("All updates checked");
Expand Down

0 comments on commit f6213ea

Please sign in to comment.