Make API calls more robust for bigger queries

- Also fix sorting for different version formats
This commit is contained in:
Yuri Sizov
2023-03-24 11:49:20 +01:00
parent 61299232f3
commit b93c3a8237
2 changed files with 60 additions and 25 deletions

View File

@@ -77,7 +77,7 @@ async function publishConfigs() {
await fs.access(configPath, fsConstants.R_OK);
const configContent = await fs.readFile(configPath);
const config = JSON.parse(configContent);
const [ config_owner, config_repo ] = nameBits;
@@ -101,10 +101,16 @@ async function publishConfigs() {
const envalueVersion = (versionString) => {
let value = 0;
const versionBits = versionString.split(".");
while (versionBits.length < 4) {
// Make sure we have exactly 4 values in the version. Normally Godot
// versions are either X.Y or X.Y.Z, but there are exceptions, so we
// normalize the size to match them.
versionBits.push("0");
}
let i = 0;
while (versionBits.length > 0) {
value += versionBits.pop() * Math.pow(100, i);
value += parseInt(versionBits.pop(), 10) * Math.pow(100, i);
i++;
}