Fixed consistency script
This commit is contained in:
parent
588d3c45b5
commit
da29293390
|
@ -85,6 +85,14 @@ async function checkAvailableIPsFromCircuit(fix?: boolean) {
|
|||
isAvailable: false,
|
||||
});
|
||||
}
|
||||
// Check if it's marked to unavailable
|
||||
} else if (ipv4[0].isAvailable) {
|
||||
console.log(`Inconsistency: ${circuit.username}, ${circuit.ipv4}`);
|
||||
if (fix) {
|
||||
console.log(`Fixing: ${circuit.username}, ${circuit.ipv4}`);
|
||||
ipv4[0].isAvailable = false;
|
||||
await ipv4PoolRepository.update(ipv4[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the IPv6 is in the pool
|
||||
|
@ -93,7 +101,6 @@ async function checkAvailableIPsFromCircuit(fix?: boolean) {
|
|||
prefix: (circuit.ipv6) ? circuit.ipv6.valueOf() : ''
|
||||
}
|
||||
});
|
||||
|
||||
// We must test if circuit.ipv6 exists
|
||||
if (!ipv6.length && circuit.ipv6) {
|
||||
console.log(`Inconsistency: ${circuit.username}, ${circuit.ipv6}`);
|
||||
|
@ -104,6 +111,13 @@ async function checkAvailableIPsFromCircuit(fix?: boolean) {
|
|||
isAvailable: false,
|
||||
});
|
||||
}
|
||||
} else if (ipv6.length && ipv6[0].isAvailable) {
|
||||
console.log(`Inconsistency: ${circuit.username}, ${circuit.ipv6}`);
|
||||
if (fix) {
|
||||
console.log(`Fixing: ${circuit.username}, ${circuit.ipv6}`);
|
||||
ipv6[0].isAvailable = false;
|
||||
await ipv6PoolRepository.update(ipv6[0]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue