mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-04 12:13:28 -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(() => {
|
setTimeout(() => {
|
||||||
setIsServerReady(true);
|
setIsServerReady(true);
|
||||||
setActiveInterfaceTab(defaultInterfaceTab);
|
setActiveInterfaceTab(defaultInterfaceTab);
|
||||||
}, 1000);
|
}, 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
return cleanup;
|
return cleanup;
|
||||||
|
|
|
||||||
|
|
@ -38,15 +38,23 @@ export const startTunnel = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
const tunnelTarget = getTunnelTarget(frontendPreference);
|
const tunnelTarget = getTunnelTarget(frontendPreference);
|
||||||
const tunnel = Tunnel.quick(tunnelTarget, {
|
const tunnel = Tunnel.quick(tunnelTarget, { '--no-autoupdate': true });
|
||||||
'--no-autoupdate': true,
|
|
||||||
});
|
|
||||||
|
|
||||||
activeTunnel = tunnel;
|
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 url = await new Promise<string>((resolve, reject) => {
|
||||||
const timeout = setTimeout(() => {
|
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);
|
}, 30000);
|
||||||
|
|
||||||
tunnel.once('url', (url) => {
|
tunnel.once('url', (url) => {
|
||||||
|
|
@ -64,7 +72,7 @@ export const startTunnel = async (
|
||||||
sendKoboldOutput(`Tunnel ready at ${tunnelUrl}`);
|
sendKoboldOutput(`Tunnel ready at ${tunnelUrl}`);
|
||||||
sendToRenderer('tunnel-url-changed', tunnelUrl);
|
sendToRenderer('tunnel-url-changed', tunnelUrl);
|
||||||
|
|
||||||
tunnel.on('error', (error) => {
|
tunnel.on('error', (error: Error) => {
|
||||||
logError(`Tunnel error: ${error.message}`, error);
|
logError(`Tunnel error: ${error.message}`, error);
|
||||||
sendKoboldOutput(`Tunnel error: ${error.message}`);
|
sendKoboldOutput(`Tunnel error: ${error.message}`);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue