File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
apps/sim/providers/gemini Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -396,15 +396,15 @@ function sleep(ms: number, signal?: AbortSignal): Promise<void> {
396396 )
397397 }
398398 return new Promise ( ( resolve , reject ) => {
399- const timer = setTimeout ( resolve , ms )
400- signal ?. addEventListener (
401- 'abort' ,
402- ( ) => {
403- clearTimeout ( timer )
404- reject ( signal . reason ?? new DOMException ( 'The operation was aborted. ', 'AbortError' ) )
405- } ,
406- { once : true }
407- )
399+ const onAbort = ( ) => {
400+ clearTimeout ( timer )
401+ reject ( signal ! . reason ?? new DOMException ( 'The operation was aborted.' , 'AbortError' ) )
402+ }
403+ const timer = setTimeout ( ( ) => {
404+ signal ?. removeEventListener ( 'abort ', onAbort )
405+ resolve ( )
406+ } , ms )
407+ signal ?. addEventListener ( 'abort' , onAbort , { once : true } )
408408 } )
409409}
410410
You can’t perform that action at this time.
0 commit comments