mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-23 14:07:20 +03:00
my own way to test timeouts
This commit is contained in:
parent
b7f451b5d9
commit
ec3ec50ea6
@ -49,6 +49,8 @@ const REJECT_LIST = [
|
||||
"dashboard",
|
||||
"analytics",
|
||||
"data",
|
||||
"timeout",
|
||||
"please-dont-use-timeout",
|
||||
];
|
||||
|
||||
// TODO(martina): Make sure you catch cases where this isn't passed in to be safe.
|
||||
|
17
server.js
17
server.js
@ -18,6 +18,12 @@ const app = next({
|
||||
quiet: false,
|
||||
});
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
const handler = app.getRequestHandler();
|
||||
|
||||
app.prepare().then(async () => {
|
||||
@ -33,6 +39,17 @@ app.prepare().then(async () => {
|
||||
server.headersTimeout = 16 * 60 * 1000;
|
||||
|
||||
server.use("/public", express.static("public"));
|
||||
|
||||
server.get("/please-dont-use-timeout", async (r, s) => {
|
||||
console.log("[ forbidden ] someone is using your testing timeout");
|
||||
|
||||
await sleep(15 * 60 * 1000);
|
||||
|
||||
return res
|
||||
.status(200)
|
||||
.send({ decorator: "15_MINUTE_TEST", data: { success: true } });
|
||||
});
|
||||
|
||||
server.get("/system", async (r, s) => s.redirect("/_/system"));
|
||||
server.get("/experiences", async (r, s) => s.redirect("/_/system"));
|
||||
server.get("/_/experiences", async (r, s) => s.redirect("/_/system"));
|
||||
|
Loading…
Reference in New Issue
Block a user