Skip to content

Commit

Permalink
fix: hard sticky strategy with no desired worker id (#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
abelanger5 authored Jan 14, 2025
1 parent 3be99f6 commit 75657a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/scheduling/v2/slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,13 @@ func getRankedSlots(
continue
}

// if this is a HARD sticky strategy, it can only be assigned to the desired worker if the desired
// worker id is set. otherwise, it cannot be assigned.
// if this is a HARD sticky strategy, and there's a desired worker id, it can only be assigned to that
// worker. if there's no desired worker id, we assign to any worker.
if qi.Sticky.Valid && qi.Sticky.StickyStrategy == dbsqlc.StickyStrategyHARD {
if qi.DesiredWorkerId.Valid && workerId == sqlchelpers.UUIDToStr(qi.DesiredWorkerId) {
validSlots.addSlot(slot, 0)
} else if !qi.DesiredWorkerId.Valid {
validSlots.addSlot(slot, 0)
}

continue
Expand Down

0 comments on commit 75657a1

Please sign in to comment.