mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 18:24:35 +00:00
perf: use .abort.bind() instead of arrow closures to prevent memory leaks (#7174)
This commit is contained in:
committed by
Peter Steinberger
parent
d637a26350
commit
d9c582627c
@@ -937,7 +937,7 @@ async function summarizeText(params: {
|
||||
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
||||
const timeout = setTimeout(controller.abort.bind(controller), timeoutMs);
|
||||
|
||||
try {
|
||||
const res = await completeSimple(
|
||||
@@ -1038,7 +1038,7 @@ async function elevenLabsTTS(params: {
|
||||
const normalizedSeed = normalizeSeed(seed);
|
||||
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
||||
const timeout = setTimeout(controller.abort.bind(controller), timeoutMs);
|
||||
|
||||
try {
|
||||
const url = new URL(`${normalizeElevenLabsBaseUrl(baseUrl)}/v1/text-to-speech/${voiceId}`);
|
||||
@@ -1098,7 +1098,7 @@ async function openaiTTS(params: {
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
||||
const timeout = setTimeout(controller.abort.bind(controller), timeoutMs);
|
||||
|
||||
try {
|
||||
const response = await fetch(`${getOpenAITtsBaseUrl()}/audio/speech`, {
|
||||
|
||||
Reference in New Issue
Block a user