Skip to content

Commit

Permalink
WIP to work around #3983
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Oct 23, 2024
1 parent 17acdd3 commit 00febd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion js/eventloop/eventloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,16 @@ func (e *EventLoop) RegisterCallback() (enqueueCallback func(func() error)) {
panic("RegisterCallback called twice")
}
callbackCalled = true
e.queue = append(e.queue, f)
wrapFunc := func() error {
rt := e.vu.Runtime()
callable, _ := sobek.AssertFunction(rt.ToValue(f))
_, err := callable(nil)
// if there is an exception the err will be nil either way

return err
}

e.queue = append(e.queue, wrapFunc)
e.registeredCallbacks--
e.lock.Unlock()
e.wakeup()
Expand Down
5 changes: 4 additions & 1 deletion vendor/github.com/grafana/sobek/builtin_promise.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 00febd9

Please sign in to comment.