diff options
author | 2023-11-04 20:21:20 +0000 | |
---|---|---|
committer | 2023-11-04 20:21:20 +0000 | |
commit | 41435a6c4ee0a5b52528890edf3fbf5a9dc0a6c8 (patch) | |
tree | 987b5d7787b24f6f6e340bbcf7fd1b052fe40dfc /cmd | |
parent | [docs/bugfix] fix link to swagger yaml (#2333) (diff) | |
download | gotosocial-41435a6c4ee0a5b52528890edf3fbf5a9dc0a6c8.tar.xz |
[feature] support canceling scheduled tasks, some federation API performance improvements (#2329)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gotosocial/action/server/server.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cmd/gotosocial/action/server/server.go b/cmd/gotosocial/action/server/server.go index 3b21c7ebe..7ade78166 100644 --- a/cmd/gotosocial/action/server/server.go +++ b/cmd/gotosocial/action/server/server.go @@ -27,7 +27,6 @@ import ( "syscall" "time" - "codeberg.org/gruf/go-sched" "github.com/gin-gonic/gin" "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action" "github.com/superseriousbusiness/gotosocial/internal/api" @@ -123,16 +122,21 @@ var Start action.GTSAction = func(ctx context.Context) error { // Add a task to the scheduler to sweep caches. // Frequency = 1 * minute // Threshold = 80% capacity - sweep := func(time.Time) { state.Caches.Sweep(80) } - job := sched.NewJob(sweep).Every(time.Minute) - _ = state.Workers.Scheduler.Schedule(job) + _ = state.Workers.Scheduler.AddRecurring( + "@cachesweep", // id + time.Time{}, // start + time.Minute, // freq + func(context.Context, time.Time) { + state.Caches.Sweep(80) + }, + ) // Build handlers used in later initializations. mediaManager := media.NewManager(&state) oauthServer := oauth.New(ctx, dbService) typeConverter := typeutils.NewConverter(&state) filter := visibility.NewFilter(&state) - federatingDB := federatingdb.New(&state, typeConverter) + federatingDB := federatingdb.New(&state, typeConverter, filter) transportController := transport.NewController(&state, federatingDB, &federation.Clock{}, client) federator := federation.NewFederator(&state, federatingDB, transportController, typeConverter, mediaManager) |