MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / hashCode

Function hashCode

yvlu/yvlu.ts:37–47  ·  view source on GitHub ↗
(s: any)

Source from the content-addressed store, hash-verified

35
36const execFileAsync = promisify(execFile);
37
38const timeout = 60000; // 超时
39const PYTHON_PATH = "python3"; // Python 路径,可修改为 venv 中的路径,如:"/path/to/venv/bin/python"
40
41const QUOTE_RPC_TIMEOUT_MS = 20000;
42
43function withTimeout<T>(promise: Promise<T>, ms: number, label: string): Promise<T> {
44 let timer: NodeJS.Timeout;
45 const timeout = new Promise<never>((_, reject) => {
46 timer = setTimeout(() => reject(new Error(`${label} timed out after ${ms}ms`)), ms);
47 if (timer.unref) timer.unref();
48 });
49 return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
50}

Callers 2

YvluPluginClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected