diff options
author | 2023-10-30 18:35:11 +0100 | |
---|---|---|
committer | 2023-10-30 17:35:11 +0000 | |
commit | 4dc0547dc0e80a4289f46cd8ee5b3aaf855f1f1e (patch) | |
tree | 465b66e88a1defdae6c29f86e9e1a3269dc474ff /cmd | |
parent | [chore]: Bump github.com/google/uuid from 1.3.1 to 1.4.0 (#2315) (diff) | |
download | gotosocial-4dc0547dc0e80a4289f46cd8ee5b3aaf855f1f1e.tar.xz |
[feature] Customizable media cleaner schedule (#2304)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gotosocial/action/server/server.go | 25 | ||||
-rw-r--r-- | cmd/gotosocial/action/testrig/testrig.go | 7 |
2 files changed, 20 insertions, 12 deletions
diff --git a/cmd/gotosocial/action/server/server.go b/cmd/gotosocial/action/server/server.go index 2e32ec657..3b21c7ebe 100644 --- a/cmd/gotosocial/action/server/server.go +++ b/cmd/gotosocial/action/server/server.go @@ -32,6 +32,7 @@ import ( "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action" "github.com/superseriousbusiness/gotosocial/internal/api" apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" + "github.com/superseriousbusiness/gotosocial/internal/cleaner" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/middleware" tlprocessor "github.com/superseriousbusiness/gotosocial/internal/processing/timeline" @@ -173,8 +174,19 @@ var Start action.GTSAction = func(ctx context.Context) error { return fmt.Errorf("error starting list timeline: %s", err) } + // Create a media cleaner using the given state. + cleaner := cleaner.New(&state) + // Create the processor using all the other services we've created so far. - processor := processing.NewProcessor(typeConverter, federator, oauthServer, mediaManager, &state, emailSender) + processor := processing.NewProcessor( + cleaner, + typeConverter, + federator, + oauthServer, + mediaManager, + &state, + emailSender, + ) // Set state client / federator asynchronous worker enqueue functions state.Workers.EnqueueClientAPI = processor.Workers().EnqueueClientAPI @@ -297,12 +309,9 @@ var Start action.GTSAction = func(ctx context.Context) error { activityPubModule.RoutePublicKey(router, s2sLimit, pkThrottle, gzip) webModule.Route(router, fsLimit, fsThrottle, gzip) - gts, err := gotosocial.NewServer(dbService, router, federator, mediaManager) - if err != nil { - return fmt.Errorf("error creating gotosocial service: %s", err) - } - - if err := gts.Start(ctx); err != nil { + // Start the GoToSocial server. + server := gotosocial.NewServer(dbService, router, cleaner) + if err := server.Start(ctx); err != nil { return fmt.Errorf("error starting gotosocial service: %s", err) } @@ -313,7 +322,7 @@ var Start action.GTSAction = func(ctx context.Context) error { log.Infof(ctx, "received signal %s, shutting down", sig) // close down all running services in order - if err := gts.Stop(ctx); err != nil { + if err := server.Stop(ctx); err != nil { return fmt.Errorf("error closing gotosocial service: %s", err) } diff --git a/cmd/gotosocial/action/testrig/testrig.go b/cmd/gotosocial/action/testrig/testrig.go index 288c5975d..f125cd119 100644 --- a/cmd/gotosocial/action/testrig/testrig.go +++ b/cmd/gotosocial/action/testrig/testrig.go @@ -32,6 +32,7 @@ import ( "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action" "github.com/superseriousbusiness/gotosocial/internal/api" apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" + "github.com/superseriousbusiness/gotosocial/internal/cleaner" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/gotosocial" "github.com/superseriousbusiness/gotosocial/internal/gtserror" @@ -211,11 +212,9 @@ var Start action.GTSAction = func(ctx context.Context) error { activityPubModule.RoutePublicKey(router) webModule.Route(router) - gts, err := gotosocial.NewServer(state.DB, router, federator, mediaManager) - if err != nil { - return fmt.Errorf("error creating gotosocial service: %s", err) - } + cleaner := cleaner.New(&state) + gts := gotosocial.NewServer(state.DB, router, cleaner) if err := gts.Start(ctx); err != nil { return fmt.Errorf("error starting gotosocial service: %s", err) } |