From 532494b3f6fc914b4614fa1f8409c5d09be46507 Mon Sep 17 00:00:00 2001 From: Nathaniel Caza Date: Tue, 11 Feb 2025 09:25:08 -0600 Subject: [PATCH] refactor(rotation): update comments for lookForWork and updateRotation functions for clarity --- engine/rotationmanager/lookforwork.go | 2 +- engine/rotationmanager/setup.go | 2 +- engine/rotationmanager/updaterotation.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/rotationmanager/lookforwork.go b/engine/rotationmanager/lookforwork.go index 13cbb86682..cc97987c58 100644 --- a/engine/rotationmanager/lookforwork.go +++ b/engine/rotationmanager/lookforwork.go @@ -15,7 +15,7 @@ type LookForWorkArgs struct{} func (LookForWorkArgs) Kind() string { return "rotation-manager-lfw" } -// cleanup is a worker function that will remove any stale subscriptions. +// lookForWork will schedule jobs for rotations in the entity_updates table. func (db *DB) lookForWork(ctx context.Context, j *river.Job[LookForWorkArgs]) error { var hadWork bool err := db.lock.WithTxShared(ctx, func(ctx context.Context, tx *sql.Tx) error { diff --git a/engine/rotationmanager/setup.go b/engine/rotationmanager/setup.go index 0fe8d9f095..ac7e56b1f3 100644 --- a/engine/rotationmanager/setup.go +++ b/engine/rotationmanager/setup.go @@ -18,7 +18,7 @@ const ( PriorityLFW = 4 ) -var _ processinglock.Setupable = &DB{} +var _ processinglock.Setupable = (*DB)(nil) // assert that DB implements processinglock.Setupable // Setup implements processinglock.Setupable. func (db *DB) Setup(ctx context.Context, args processinglock.SetupArgs) error { diff --git a/engine/rotationmanager/updaterotation.go b/engine/rotationmanager/updaterotation.go index 326773048b..9ca3d3f364 100644 --- a/engine/rotationmanager/updaterotation.go +++ b/engine/rotationmanager/updaterotation.go @@ -20,7 +20,7 @@ type UpdateArgs struct { func (UpdateArgs) Kind() string { return "rotation-manager-update" } -// cleanup is a worker function that will remove any stale subscriptions. +// updateRotation updates the state of a single rotation, and schedules a job for the next rotation time. func (db *DB) updateRotation(ctx context.Context, j *river.Job[UpdateArgs]) error { return db.lock.WithTxShared(ctx, func(ctx context.Context, tx *sql.Tx) error { g := gadb.New(tx)