From 67d421db5dfef389027668a47b09a1e594a04680 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:14:17 -0800 Subject: [PATCH] add task to purge invitation tokens --- backend/app/api/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/app/api/main.go b/backend/app/api/main.go index 09191a4..bb76e69 100644 --- a/backend/app/api/main.go +++ b/backend/app/api/main.go @@ -138,6 +138,14 @@ func run(cfg *config.Config) error { Msg("failed to purge expired tokens") } }) + go app.startBgTask(time.Duration(24)*time.Hour, func() { + _, err := app.repos.Groups.InvitationPurge(context.Background()) + if err != nil { + log.Error(). + Err(err). + Msg("failed to purge expired invitations") + } + }) // TODO: Remove through external API that does setup if cfg.Demo {