mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
Replace eslint and prettier with Biome
This commit is contained in:
parent
4a5a2ea590
commit
af0d627f19
199 changed files with 16493 additions and 16361 deletions
|
|
@ -4,11 +4,11 @@ const requests: Promise<Response>[] = [];
|
|||
|
||||
// Repeat 1000 times
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
requests.push(
|
||||
fetch(`https://mastodon.social`, {
|
||||
method: "GET",
|
||||
})
|
||||
);
|
||||
requests.push(
|
||||
fetch("https://mastodon.social", {
|
||||
method: "GET",
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
await Promise.all(requests);
|
||||
|
|
|
|||
|
|
@ -9,46 +9,46 @@ const token = process.env.TOKEN;
|
|||
const requestCount = Number(process.argv[2]) || 100;
|
||||
|
||||
if (!token) {
|
||||
console.log(
|
||||
`${chalk.red(
|
||||
"✗"
|
||||
)} No token provided. Provide one via the TOKEN environment variable.`
|
||||
);
|
||||
process.exit(1);
|
||||
console.log(
|
||||
`${chalk.red(
|
||||
"✗",
|
||||
)} No token provided. Provide one via the TOKEN environment variable.`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const fetchTimeline = () =>
|
||||
fetch(`${config.http.base_url}/api/v1/timelines/home`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}).then(res => res.ok);
|
||||
fetch(`${config.http.base_url}/api/v1/timelines/home`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}).then((res) => res.ok);
|
||||
|
||||
const timeNow = performance.now();
|
||||
|
||||
const requests = Array.from({ length: requestCount }, () => fetchTimeline());
|
||||
|
||||
Promise.all(requests)
|
||||
.then(results => {
|
||||
const timeTaken = performance.now() - timeNow;
|
||||
if (results.every(t => t)) {
|
||||
console.log(`${chalk.green("✓")} All requests succeeded`);
|
||||
} else {
|
||||
console.log(
|
||||
`${chalk.red("✗")} ${
|
||||
results.filter(t => !t).length
|
||||
} requests failed`
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
`${chalk.green("✓")} ${
|
||||
requests.length
|
||||
} requests fulfilled in ${chalk.bold(
|
||||
(timeTaken / 1000).toFixed(5)
|
||||
)}s`
|
||||
);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(`${chalk.red("✗")} ${err}`);
|
||||
process.exit(1);
|
||||
});
|
||||
.then((results) => {
|
||||
const timeTaken = performance.now() - timeNow;
|
||||
if (results.every((t) => t)) {
|
||||
console.log(`${chalk.green("✓")} All requests succeeded`);
|
||||
} else {
|
||||
console.log(
|
||||
`${chalk.red("✗")} ${
|
||||
results.filter((t) => !t).length
|
||||
} requests failed`,
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
`${chalk.green("✓")} ${
|
||||
requests.length
|
||||
} requests fulfilled in ${chalk.bold(
|
||||
(timeTaken / 1000).toFixed(5),
|
||||
)}s`,
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(`${chalk.red("✗")} ${err}`);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue