Spaces:
Runtime error
Runtime error
Download network_fix.js from Brozy123/LineUp-Bot: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/Brozy123/LineUp-Bot/resolve/main/network_fix.js
- Command line
-
hf download hf://spaces/Brozy123/LineUp-Bot/network_fix.js
-
curl -L -o network_fix.js https://huggingface.co/spaces/Brozy123/LineUp-Bot/resolve/main/network_fix.js
1.08 kB
| const dns = require('dns'); | |
| /** | |
| * Connection Patience Fix. | |
| * Increases the timeout to 120 seconds to prevent the "Connect Timeout Error". | |
| */ | |
| function applyAdvancedFixes() { | |
| console.log(`[NETWORK] Increasing connection patience to 120s...`); | |
| try { | |
| const { setGlobalDispatcher, Agent } = require('undici'); | |
| const agent = new Agent({ | |
| connect: { | |
| timeout: 120000 // 2 minutes! | |
| } | |
| }); | |
| setGlobalDispatcher(agent); | |
| this._dispatcher = agent; | |
| } catch (e) {} | |
| } | |
| function getDispatcher() { return this._dispatcher; } | |
| function rotateEndpoint() { | |
| try { | |
| const ultimateFix = require('./ultimate_fix'); | |
| if (ultimateFix && typeof ultimateFix.rotateEndpoint === 'function') { | |
| ultimateFix.rotateEndpoint(); | |
| } | |
| } catch (e) { | |
| console.error("[NETWORK FIX] Error rotating endpoint:", e.message); | |
| } | |
| } | |
| function getTargetDomain() { return 'discord.com'; } | |
| module.exports = { applyAdvancedFixes, rotateEndpoint, getTargetDomain, getDispatcher }; | |