Decrease connection timeout, set 'valid' status on 'invalid URL', don't wait if not needed

Fixes #3683
This commit is contained in:
Cohee
2025-03-14 10:43:00 +02:00
parent c9e716d42f
commit f362f94c2d
2 changed files with 5 additions and 8 deletions

View File

@ -9288,10 +9288,12 @@ async function connectAPISlash(args, text) {
const toast = quiet ? jQuery() : toastr.info(t`API set to ${text}, trying to connect..`);
try {
await waitUntilCondition(() => online_status !== 'no_connection', 10000, 100);
if (connectionRequired) {
await waitUntilCondition(() => online_status !== 'no_connection', 5000, 500);
}
console.log('Connection successful');
} catch {
console.log('Could not connect after 10 seconds, skipping.');
console.log('Could not connect after 5 seconds, skipping.');
}
toastr.clear(toast);