File tree 2 files changed +3
-6
lines changed
2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ func genericTransformWithCallbacks(t transform) transform {
206
206
}
207
207
208
208
ctx , is = callbacks .OnStartWithStreamInput (ctx , is )
209
+ is .Close () // goroutine free copy buffer release
209
210
210
211
output , err = t (ctx , inArr [0 ], opts ... )
211
212
if err != nil {
@@ -219,7 +220,8 @@ func genericTransformWithCallbacks(t transform) transform {
219
220
return outArr [0 ], nil
220
221
}
221
222
222
- _ , _ = callbacks .OnEndWithStreamOutput (ctx , os )
223
+ _ , os = callbacks .OnEndWithStreamOutput (ctx , os )
224
+ os .Close ()
223
225
224
226
return outArr [0 ], nil
225
227
}
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ import (
23
23
"reflect"
24
24
"runtime/debug"
25
25
"sync"
26
- "sync/atomic"
27
26
28
27
"github.com/cloudwego/eino/utils/safe"
29
28
)
@@ -305,10 +304,6 @@ func (s *stream[T]) closeSend() {
305
304
}
306
305
307
306
func (s * stream [T ]) closeRecv () {
308
- if ! atomic .CompareAndSwapUint32 (& s .isClosed , 0 , 1 ) {
309
- return
310
- }
311
-
312
307
close (s .closed )
313
308
}
314
309
You can’t perform that action at this time.
0 commit comments