diff options
author | 2023-03-01 18:26:53 +0000 | |
---|---|---|
committer | 2023-03-01 18:26:53 +0000 | |
commit | baf933cb9f3e1053bdb61b90d7027efe9fad1bc2 (patch) | |
tree | 3f2a76851d58517ca3dece2bacd6aceefd8dfb96 /testrig/util.go | |
parent | [feature] Federate pinned posts (aka `featuredCollection`) in and out (#1560) (diff) | |
download | gotosocial-baf933cb9f3e1053bdb61b90d7027efe9fad1bc2.tar.xz |
[chore] move client/federator workerpools to Workers{} (#1575)
* replace concurrency worker pools with base models in State.Workers, update code and tests accordingly
* improve code comment
* change back testrig default log level
* un-comment-out TestAnnounceTwice() and fix
---------
Signed-off-by: kim <grufwub@gmail.com>
Reviewed-by: tobi
Diffstat (limited to 'testrig/util.go')
-rw-r--r-- | testrig/util.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testrig/util.go b/testrig/util.go index cc392b315..0cda93024 100644 --- a/testrig/util.go +++ b/testrig/util.go @@ -20,13 +20,34 @@ package testrig import ( "bytes" + "context" "io" "mime/multipart" "net/url" "os" "time" + + "github.com/superseriousbusiness/gotosocial/internal/messages" + "github.com/superseriousbusiness/gotosocial/internal/state" ) +func StartWorkers(state *state.State) { + state.Workers.EnqueueClientAPI = func(context.Context, messages.FromClientAPI) {} + state.Workers.EnqueueFederator = func(context.Context, messages.FromFederator) {} + + _ = state.Workers.Scheduler.Start(nil) + _ = state.Workers.ClientAPI.Start(1, 10) + _ = state.Workers.Federator.Start(1, 10) + _ = state.Workers.Media.Start(1, 10) +} + +func StopWorkers(state *state.State) { + _ = state.Workers.Scheduler.Stop() + _ = state.Workers.ClientAPI.Stop() + _ = state.Workers.Federator.Stop() + _ = state.Workers.Media.Stop() +} + // CreateMultipartFormData is a handy function for taking a fieldname and a filename, and creating a multipart form bytes buffer // with the file contents set in the given fieldname. The extraFields param can be used to add extra FormFields to the request, as necessary. // The returned bytes.Buffer b can be used like so: |