summaryrefslogtreecommitdiff
path: root/pkg/pool
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-05 16:39:22 +0300
committerValery Piashchynski <[email protected]>2021-05-05 16:39:22 +0300
commit4fa94bb7f73a705293c2afd40fc1151a3aaa04e2 (patch)
tree6ffd858cade87600bbd4432f70db22f50c598db0 /pkg/pool
parent9ee78f937d5be67058882dd3590f89da35bca239 (diff)
- Initial broadcast commit
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/pool')
-rwxr-xr-xpkg/pool/static_pool.go6
-rwxr-xr-xpkg/pool/static_pool_test.go3
2 files changed, 5 insertions, 4 deletions
diff --git a/pkg/pool/static_pool.go b/pkg/pool/static_pool.go
index e769093c..54192262 100755
--- a/pkg/pool/static_pool.go
+++ b/pkg/pool/static_pool.go
@@ -4,7 +4,6 @@ import (
"context"
"os/exec"
"time"
- "unsafe"
"github.com/spiral/errors"
"github.com/spiral/roadrunner/v2/pkg/events"
@@ -12,6 +11,7 @@ import (
"github.com/spiral/roadrunner/v2/pkg/transport"
"github.com/spiral/roadrunner/v2/pkg/worker"
workerWatcher "github.com/spiral/roadrunner/v2/pkg/worker_watcher"
+ "github.com/spiral/roadrunner/v2/utils"
)
// StopRequest can be sent by worker to indicate that restart is required.
@@ -153,7 +153,7 @@ func (sp *StaticPool) Exec(p payload.Payload) (payload.Payload, error) {
}
// worker want's to be terminated
- if len(rsp.Body) == 0 && toString(rsp.Context) == StopRequest {
+ if len(rsp.Body) == 0 && utils.AsString(rsp.Context) == StopRequest {
sp.stopWorker(w)
return sp.Exec(p)
}
@@ -183,7 +183,7 @@ func (sp *StaticPool) execWithTTL(ctx context.Context, p payload.Payload) (paylo
}
// worker want's to be terminated
- if len(rsp.Body) == 0 && toString(rsp.Context) == StopRequest {
+ if len(rsp.Body) == 0 && utils.AsString(rsp.Context) == StopRequest {
sp.stopWorker(w)
return sp.execWithTTL(ctx, p)
}
diff --git a/pkg/pool/static_pool_test.go b/pkg/pool/static_pool_test.go
index 69527815..bf7f10e0 100755
--- a/pkg/pool/static_pool_test.go
+++ b/pkg/pool/static_pool_test.go
@@ -16,6 +16,7 @@ import (
"github.com/spiral/roadrunner/v2/pkg/payload"
"github.com/spiral/roadrunner/v2/pkg/transport/pipe"
"github.com/spiral/roadrunner/v2/pkg/worker"
+ "github.com/spiral/roadrunner/v2/utils"
"github.com/stretchr/testify/assert"
)
@@ -653,7 +654,7 @@ func BenchmarkToStringUnsafe(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
- res := toString(testPayload)
+ res := utils.AsString(testPayload)
_ = res
}
}