⚡ benchmark
This commit is contained in:
parent
ed2a1809ff
commit
f846638b83
4215
package-lock.json
generated
4215
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,6 @@
|
||||
"missing-native-js-functions": "^1.2.4",
|
||||
"mongodb": "^3.6.4",
|
||||
"mongoose-long": "^0.3.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"patch-package": "^6.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -46,6 +45,8 @@
|
||||
"@types/jsonwebtoken": "^8.5.0",
|
||||
"@types/node": "^14.14.22",
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"0x": "^4.10.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.1.2"
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
import fetch from "node-fetch";
|
||||
|
||||
fetch("https://discord.com/api/v8/auth/mfa/totp", {
|
||||
headers: {
|
||||
authorization: "undefined",
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
code: "722608",
|
||||
ticket: "WzMxMTEyOTM1NzM2MjEzNTA0MSwibG9naW4iXQ.X8LHqg.vTwtZBaLu5W_XMMSvKad1OAaEoA",
|
||||
login_source: null,
|
||||
gift_code_sku_id: null,
|
||||
}),
|
||||
method: "POST",
|
||||
});
|
||||
/**
|
||||
* @returns {"token": "mfa.-Rg2AwyP06YdTPmIDt0sqA92T8fBVITLTcXjP7zO_Uhgkg1FA0WERGjJXJyN_dyVDeBnxIWr0w3XiXW8YxVw", "user_settings": {"locale": "en-GB", "theme": "dark"}}
|
||||
*/
|
||||
|
||||
// token: mfa.-Rg2AwyP06YdTPmIDt0sqA92T8fBVITLTcXjP7zO_Uhgkg1FA0WERGjJXJyN_dyVDeBnxIWr0w3XiXW8YxVw
|
||||
|
||||
fetch("https://discord.com/api/v8/gateway", {
|
||||
headers: {
|
||||
authorization: "token",
|
||||
},
|
||||
method: "GET",
|
||||
});
|
||||
/**
|
||||
* @returns {"url": "wss://gateway.discord.gg"}
|
||||
*/
|
@ -6,8 +6,9 @@ import { config } from "dotenv";
|
||||
config();
|
||||
import { DiscordServer } from "./Server";
|
||||
|
||||
const server = new DiscordServer({ port: 3000 });
|
||||
const server = new DiscordServer({ port: 3000 || process.env.PORT });
|
||||
server.start().catch(console.error);
|
||||
|
||||
// @ts-ignore
|
||||
global.server = server;
|
||||
export default server;
|
||||
|
39
src/test/server_benchmark.ts
Normal file
39
src/test/server_benchmark.ts
Normal file
@ -0,0 +1,39 @@
|
||||
// @ts-nocheck
|
||||
import "missing-native-js-functions";
|
||||
import { config } from "dotenv";
|
||||
config();
|
||||
import { DiscordServer } from "../Server";
|
||||
import fetch from "node-fetch";
|
||||
import { promises } from "fs";
|
||||
const count = 100;
|
||||
|
||||
async function main() {
|
||||
const server = new DiscordServer({ port: 3000 });
|
||||
await server.start();
|
||||
|
||||
const tasks = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
tasks.push(test());
|
||||
}
|
||||
|
||||
await Promise.all(tasks);
|
||||
|
||||
console.log("logging in 5secs");
|
||||
setTimeout(async () => {
|
||||
await test();
|
||||
|
||||
process.exit();
|
||||
}, 5000);
|
||||
}
|
||||
main();
|
||||
|
||||
async function test() {
|
||||
const res = await fetch("http://localhost:3000/api/v8/guilds/813524615463698433/members/813524464300982272", {
|
||||
headers: {
|
||||
authorization:
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjgxMzUyNDQ2NDMwMDk4MjI3MiIsImlhdCI6MTYxNDAyOTc0Nn0.6WQiU4D5HHRi3sliHOQe1hsW-hZTEttvdtZuNIdviNI",
|
||||
},
|
||||
});
|
||||
|
||||
return await res.text();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user