Skip to content

Commit c50207b

Browse files
authored
fix: remove node timeout (#1011)
replace Node.js timeout with Go-based timeout
1 parent fef0518 commit c50207b

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

cli/serverless/nodejs/templates/wrapper_ts.tmpl

+3-14
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
_writeSFNHeader,
77
_FunctionCall,
88
_createConnection,
9-
withTimeout,
109
} from '@yomo/sfn'
1110
import { description, tag, handler } from '{{ .FileName }}'
1211

@@ -16,8 +15,6 @@ const SFN_FILE_PATH = '{{ .FilePath }}'
1615
const SOCK_PATH = join(WORK_DIR, 'sfn.sock');
1716
const REDUCE_TAG = 0xe001;
1817

19-
const TIMEOUT_DURATION = 1000 * 60
20-
2118
function run() {
2219
if (
2320
!description ||
@@ -37,20 +34,12 @@ function run() {
3734
_writeSFNHeader(conn, header)
3835
},
3936
onData: async (buf: Buffer) => {
40-
const { tag, data } = _readSFNData(buf)
37+
const { data } = _readSFNData(buf)
4138
const fc = new _FunctionCall(data)
4239
const args = fc.readLLMArguments()
43-
let result: any
40+
let result: unknown
4441
if (typeof handler === 'function') {
45-
try {
46-
result = await withTimeout(handler(args), TIMEOUT_DURATION)
47-
} catch (error) {
48-
if (error instanceof Error && error.message === 'timeout') {
49-
fc.writeLLMResult('timeout in this function calling, you should ignore this.')
50-
_writeSFNData(conn, REDUCE_TAG, JSON.stringify(fc.data))
51-
}
52-
return
53-
}
42+
result = await handler(args)
5443
}
5544
if (!result) return
5645
fc.writeLLMResult(JSON.stringify(result))

0 commit comments

Comments
 (0)