feat(practice): queue practice runs with one running and ten waiting

This commit is contained in:
shira committed 2026-10-11 15:01:07 +03:00
1 parent 51770eea6c
commit 754c745fba
40 files changed
+3040 -70

No files matched your search

@@ -74,8 +74,16 @@ type AssessmentPracticeRepository interface {
FindByScope(ctx context.Context, userID uuid.UUID, scope [IdempotencyDigestSize]byte) (PracticeSubmissionReplay, bool, error)
// LatestFinal returns the latest final submission of a practice, if any.
LatestFinal(ctx context.Context, practiceID uuid.UUID) (PracticeFinalSolution, bool, error)
// LockQueue takes the transaction-scoped lock of the practice queue and
// returns the number of queued and running jobs. Admission and the claim
// of the worker take the same lock, so a count and the insert that
// depends on it are atomic. Take it after the attempt and practice locks.
LockQueue(ctx context.Context) (active int, err error)
// ActiveRuns counts the queued and running debug runs of a practice.
ActiveRuns(ctx context.Context, practiceID uuid.UUID) (int, error)
// Submit stores a submission under the idempotency scope and queues its
// execution job in the same transaction.
// execution job in the same transaction. The caller holds the queue lock
// and has checked its limits.
Submit(ctx context.Context, submission domain.PracticeSubmission, scope [IdempotencyDigestSize]byte) error
// GetRun reads a debug run of the owner's attempt with the state of its
// job. It never returns a final submission; an unknown, foreign, or final