This commit is contained in:
parent
4a3c26b7fa
commit
58645ec2b2
@ -22,7 +22,7 @@ export default class NodeManager {
|
|||||||
* @returns the node
|
* @returns the node
|
||||||
*/
|
*/
|
||||||
getRandomNode() {
|
getRandomNode() {
|
||||||
const randomIndex = Math.floor(Math.random() * this.nodes.length);
|
const index = Math.floor(Math.random() * this.nodes.length);
|
||||||
return this.nodes[randomIndex];
|
return this.nodes[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,11 @@ export default class ProxyRoute extends Route {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log the request
|
||||||
|
console.log(
|
||||||
|
`[${response.headers["X-Proxy-Node"]}] ${url} - ${response.status}`
|
||||||
|
);
|
||||||
|
|
||||||
// Return the JSON response
|
// Return the JSON response
|
||||||
res.status(response.status).set(response.headers).json(data);
|
res.status(response.status).set(response.headers).json(data);
|
||||||
} catch (ex: any) {
|
} catch (ex: any) {
|
||||||
|
Loading…
Reference in New Issue
Block a user