mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -07:00
increase frontend additional time-to-start time to 3 secs because windows is slow, better handling of rate limiting tunnel errors
This commit is contained in:
parent
80bb6d5e97
commit
6561e2dd09
2 changed files with 15 additions and 7 deletions
|
|
@ -66,7 +66,7 @@ export const App = () => {
|
|||
setTimeout(() => {
|
||||
setIsServerReady(true);
|
||||
setActiveInterfaceTab(defaultInterfaceTab);
|
||||
}, 1000);
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
return cleanup;
|
||||
|
|
|
|||
|
|
@ -38,15 +38,23 @@ export const startTunnel = async (
|
|||
}
|
||||
|
||||
const tunnelTarget = getTunnelTarget(frontendPreference);
|
||||
const tunnel = Tunnel.quick(tunnelTarget, {
|
||||
'--no-autoupdate': true,
|
||||
});
|
||||
|
||||
const tunnel = Tunnel.quick(tunnelTarget, { '--no-autoupdate': true });
|
||||
activeTunnel = tunnel;
|
||||
|
||||
let rateLimited = false;
|
||||
|
||||
tunnel.on('stderr', (data: string) => {
|
||||
if (data.includes('429') || data.includes('Too Many Requests')) {
|
||||
rateLimited = true;
|
||||
}
|
||||
});
|
||||
|
||||
const url = await new Promise<string>((resolve, reject) => {
|
||||
const timeout = setTimeout(() => {
|
||||
reject(new Error('Tunnel connection timed out'));
|
||||
const message = rateLimited
|
||||
? 'Cloudflare rate limit exceeded. Please wait a few minutes and try again.'
|
||||
: 'Tunnel connection timed out';
|
||||
reject(new Error(message));
|
||||
}, 30000);
|
||||
|
||||
tunnel.once('url', (url) => {
|
||||
|
|
@ -64,7 +72,7 @@ export const startTunnel = async (
|
|||
sendKoboldOutput(`Tunnel ready at ${tunnelUrl}`);
|
||||
sendToRenderer('tunnel-url-changed', tunnelUrl);
|
||||
|
||||
tunnel.on('error', (error) => {
|
||||
tunnel.on('error', (error: Error) => {
|
||||
logError(`Tunnel error: ${error.message}`, error);
|
||||
sendKoboldOutput(`Tunnel error: ${error.message}`);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue