Buckets:
ktongue/docker_container / .cache /opencode /node_modules /hono /dist /middleware /timeout /index.js
| // src/middleware/timeout/index.ts | |
| import { HTTPException } from "../../http-exception.js"; | |
| var defaultTimeoutException = new HTTPException(504, { | |
| message: "Gateway Timeout" | |
| }); | |
| var timeout = (duration, exception = defaultTimeoutException) => { | |
| return async function timeout2(context, next) { | |
| let timer; | |
| const timeoutPromise = new Promise((_, reject) => { | |
| timer = setTimeout(() => { | |
| reject(typeof exception === "function" ? exception(context) : exception); | |
| }, duration); | |
| }); | |
| try { | |
| await Promise.race([next(), timeoutPromise]); | |
| } finally { | |
| if (timer !== void 0) { | |
| clearTimeout(timer); | |
| } | |
| } | |
| }; | |
| }; | |
| export { | |
| timeout | |
| }; | |
Xet Storage Details
- Size:
- 692 Bytes
- Xet hash:
- 02657cf7d2890e6bfd03243cc9304faca802f83d45ed239ff1a20d956b5c4e0e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.