diff options
| author | 2023-02-13 18:40:48 +0000 | |
|---|---|---|
| committer | 2023-02-13 18:40:48 +0000 | |
| commit | acc95923da555b2bf17a5638e62e533218c5840a (patch) | |
| tree | 7df5d0636137efa5b49298a8f0ced81d35767a5b /cmd/gotosocial/action/admin/media | |
| parent | [docs] move federating with gotosocial documentation into single file (#1494) (diff) | |
| download | gotosocial-acc95923da555b2bf17a5638e62e533218c5840a.tar.xz | |
[performance] processing media and scheduled jobs improvements (#1482)
* replace media workers with just runners.WorkerPool, move to state structure, use go-sched for global task scheduling
* improved code comment
* fix worker tryUntil function, update go-runners/go-sched
* make preprocess functions package public, use these where possible to stop doubled up processing
* remove separate emoji worker pool
* limit calls to time.Now() during media preprocessing
* use Processor{} to manage singular runtime of processing media
* ensure workers get started when media manager is used
* improved error setting in processing media, fix media test
* port changes from processingmedia to processing emoji
* finish code commenting
* finish code commenting and comment-out client API + federator worker pools until concurrency worker pools replaced
* linterrrrrrrrrrrrrrrr
---------
Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'cmd/gotosocial/action/admin/media')
| -rw-r--r-- | cmd/gotosocial/action/admin/media/prune/common.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/cmd/gotosocial/action/admin/media/prune/common.go b/cmd/gotosocial/action/admin/media/prune/common.go index 07b9c13bb..bd759a0d4 100644 --- a/cmd/gotosocial/action/admin/media/prune/common.go +++ b/cmd/gotosocial/action/admin/media/prune/common.go @@ -38,21 +38,24 @@ type prune struct { func setupPrune(ctx context.Context) (*prune, error) { var state state.State state.Caches.Init() + state.Workers.Start() dbService, err := bundb.NewBunDBService(ctx, &state) if err != nil { return nil, fmt.Errorf("error creating dbservice: %w", err) } - storage, err := gtsstorage.AutoConfig() //nolint:contextcheck + //nolint:contextcheck + storage, err := gtsstorage.AutoConfig() if err != nil { return nil, fmt.Errorf("error creating storage backend: %w", err) } - manager, err := media.NewManager(dbService, storage) //nolint:contextcheck - if err != nil { - return nil, fmt.Errorf("error instantiating mediamanager: %w", err) - } + state.DB = dbService + state.Storage = storage + + //nolint:contextcheck + manager := media.NewManager(&state) return &prune{ dbService: dbService, @@ -70,9 +73,5 @@ func (p *prune) shutdown(ctx context.Context) error { return fmt.Errorf("error closing dbservice: %w", err) } - if err := p.manager.Stop(); err != nil { - return fmt.Errorf("error closing media manager: %w", err) - } - return nil } |
