File size: 512 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package statusmgr

import (
	"context"
	"database/sql"

	"github.com/riverqueue/river"
	"github.com/target/goalert/gadb"
)

type CleanupArgs struct{}

func (CleanupArgs) Kind() string { return "status-manager-cleanup" }

// cleanup is a worker function that will remove any stale subscriptions.
func (db *DB) cleanup(ctx context.Context, j *river.Job[CleanupArgs]) error {
	return db.lock.WithTxShared(ctx, func(ctx context.Context, tx *sql.Tx) error {
		return gadb.New(tx).StatusMgrCleanupStaleSubs(ctx)
	})
}