Spaces:
Runtime error
Runtime error
Create network_fix.js
Browse files- network_fix.js +10 -0
network_fix.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const https = require('https');
|
| 2 |
+
const http = require('http');
|
| 3 |
+
const dns = require('dns');
|
| 4 |
+
function applyAdvancedFixes() {
|
| 5 |
+
dns.setDefaultResultOrder('ipv4first');
|
| 6 |
+
const options = { family: 4, keepAlive: true, timeout: 30000 };
|
| 7 |
+
https.globalAgent = new https.Agent(options);
|
| 8 |
+
http.globalAgent = new http.Agent(options);
|
| 9 |
+
}
|
| 10 |
+
module.exports = { applyAdvancedFixes };
|