Spaces:
Runtime error
Runtime error
Download network_fix.js from Brozy123/LineUp-Bot: direct link, hf CLI and curl.
- Browser
- Download file 897 Bytes
-
https://huggingface.co/spaces/Brozy123/LineUp-Bot/resolve/d7287468e78b0485df94de132afb92bfc4b1a1e5/network_fix.js
- Command line
-
hf download hf://spaces/Brozy123/LineUp-Bot@d7287468e78b0485df94de132afb92bfc4b1a1e5/network_fix.js
-
curl -L -o network_fix.js https://huggingface.co/spaces/Brozy123/LineUp-Bot/resolve/d7287468e78b0485df94de132afb92bfc4b1a1e5/network_fix.js
897 Bytes
| 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...`); | |
| if (dns.setDefaultResultOrder) { | |
| dns.setDefaultResultOrder('ipv4first'); | |
| } | |
| try { | |
| const { setGlobalDispatcher, Agent } = require('undici'); | |
| const agent = new Agent({ | |
| connect: { | |
| timeout: 120000, // 2 minutes! | |
| family: 4 | |
| } | |
| }); | |
| setGlobalDispatcher(agent); | |
| this._dispatcher = agent; | |
| } catch (e) {} | |
| } | |
| function getDispatcher() { return this._dispatcher; } | |
| function rotateEndpoint() {} | |
| function getTargetDomain() { return 'discord.com'; } | |
| module.exports = { applyAdvancedFixes, rotateEndpoint, getTargetDomain, getDispatcher }; | |