Skip to content

Commit d727567

Browse files
committed
asim: pass state changer directly to pushReplicateChange
Previously, we passed base queue to pushReplicateChange, but only its state changer was being used. This commit updates pushReplicateChange to only take in the state changer. Epic: none Release note: none
1 parent c37f1d2 commit d727567

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/kv/kvserver/asim/queue/lease_queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (lq *leaseQueue) Tick(ctx context.Context, tick time.Time, s state.State) {
159159
}
160160

161161
lq.next = pushReplicateChange(
162-
ctx, change, repl, tick, lq.settings.ReplicaChangeDelayFn(), lq.baseQueue)
162+
ctx, change, repl, tick, lq.settings.ReplicaChangeDelayFn(), lq.baseQueue.stateChanger)
163163
}
164164

165165
lq.lastTick = tick

pkg/kv/kvserver/asim/queue/replicate_queue.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (rq *replicateQueue) Tick(ctx context.Context, tick time.Time, s state.Stat
153153
}
154154

155155
rq.next = pushReplicateChange(
156-
ctx, change, repl, tick, rq.settings.ReplicaChangeDelayFn(), rq.baseQueue)
156+
ctx, change, repl, tick, rq.settings.ReplicaChangeDelayFn(), rq.baseQueue.stateChanger)
157157
}
158158

159159
rq.lastTick = tick
@@ -165,7 +165,7 @@ func pushReplicateChange(
165165
repl *SimulatorReplica,
166166
tick time.Time,
167167
delayFn func(int64, bool) time.Duration,
168-
queue baseQueue,
168+
stateChanger state.Changer,
169169
) time.Time {
170170
var stateChange state.Change
171171
next := tick
@@ -194,7 +194,7 @@ func pushReplicateChange(
194194
panic(fmt.Sprintf("Unknown operation %+v, unable to create state change", op))
195195
}
196196

197-
if completeAt, ok := queue.stateChanger.Push(tick, stateChange); ok {
197+
if completeAt, ok := stateChanger.Push(tick, stateChange); ok {
198198
log.VEventf(ctx, 1, "pushing state change succeeded, complete at %s (cur %s)", completeAt, tick)
199199
next = completeAt
200200
} else {

0 commit comments

Comments
 (0)