Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module github.com/JairusSW/pool

go 1.24.0

require github.com/wago-org/wago v0.0.0-20260812144524-1c58c9862d25
require github.com/wago-org/wago v0.1.0-beta.8.0.20260916050830-c9ed2455acd9

require github.com/wago-org/workers v0.0.0-20260812144603-4a90ff25d5e4
require github.com/wago-org/workers v0.1.1-0.20260916050909-fa9222c78f9d
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/wago-org/wago v0.0.0-20260812144524-1c58c9862d25 h1:gopNHvaUaDSzmW2Hfd32r8dOwwzYUHH3ph1L/IuhJUA=
github.com/wago-org/wago v0.0.0-20260812144524-1c58c9862d25/go.mod h1:6XmxI3S5qJ+YAzObyXjC6FmxHtbLhBBxrglzix42zl8=
github.com/wago-org/workers v0.0.0-20260812144603-4a90ff25d5e4 h1:Z7S9Hj+JZ8OdNWLgzRjUQOvPIEQpEFNtyRSoHnUYOlI=
github.com/wago-org/workers v0.0.0-20260812144603-4a90ff25d5e4/go.mod h1:FLuFlQ7n+DNP0VNAZuGc702UIxC/JfLuhyuacMQNFp8=
github.com/wago-org/wago v0.1.0-beta.8.0.20260916050830-c9ed2455acd9 h1:+/8b9bvAnyUZPG+YTvGpDwpAV+jpp6+bBBWOrr+8Xco=
github.com/wago-org/wago v0.1.0-beta.8.0.20260916050830-c9ed2455acd9/go.mod h1:q0pPiPF6W6GZpTXbWwy+GT+r19KHSzB/gRcPUVHyntI=
github.com/wago-org/workers v0.1.1-0.20260916050909-fa9222c78f9d h1:hx2oFfErXwEJE54E98xzIj0874SUrJL2LXi8EwkQkrQ=
github.com/wago-org/workers v0.1.1-0.20260916050909-fa9222c78f9d/go.mod h1:nFQYC2iT+rgsR2G60CF/NZm4flLcMLkYJoloAFFGztk=
12 changes: 5 additions & 7 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/wago-org/wago"
wagoplugin "github.com/wago-org/wago/plugin"
"github.com/wago-org/wago/tests/wasmtest"
"github.com/wago-org/wago/tests/support/wasmtest"
"github.com/wago-org/workers"
)

Expand Down Expand Up @@ -118,11 +118,9 @@ func driverProvider(d *driver) wago.PluginProvider {
if err != nil {
return err
}
module, err := imports.Module("env")
if err != nil {
return err
}
module.Func("run", d.run).Params(wago.ValI32, wago.ValI32, wago.ValI32).Results(wago.ValI32)
imports.HostFunc("env", "run", func(caller wago.Caller, call wago.HostCall) {
d.run(caller, call.ParamSlots(), call.ResultSlots())
}).Params(wago.ValI32, wago.ValI32, wago.ValI32).Results(wago.ValI32)
return reg.Lifecycle(wago.PluginLifecycle{
Start: d.start,
Stop: func(context.Context) error {
Expand Down Expand Up @@ -374,7 +372,7 @@ func TestContractGraphRoutesAndScales(t *testing.T) {
waitFor(t, "tasks", func() bool { return r.d.messages() == 20 })
r.invoke(t, "scale")
waitFor(t, "scale", func() bool { return r.stats(t).Live == 4 })
if err := r.rt.Close(); err != nil {
if err := r.rt.CloseContext(context.Background()); err != nil {
t.Fatal(err)
}
if err := r.d.poolRef.With(func(Service) error { return nil }); !errors.Is(err, wago.ErrPermissionDenied) {
Expand Down
13 changes: 10 additions & 3 deletions stress_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pool

import (
"context"
"errors"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -294,10 +295,16 @@ func TestStressRuntimeCloseWhileBusy(t *testing.T) {
}
}()
}
done := make(chan struct{})
go func() { r.close(); close(done) }()
closeDone := make(chan error, 1)
go func() {
_ = r.in.Close()
closeDone <- r.rt.CloseContext(context.Background())
}()
select {
case <-done:
case err := <-closeDone:
if err != nil {
t.Fatalf("runtime close: %v", err)
}
case <-time.After(10 * time.Second):
stop.Store(true)
wg.Wait()
Expand Down
Loading