Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
nolouch committed May 17, 2019
1 parent 44f601d commit 7608f63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions server/schedule/operator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,23 @@ func (oc *OperatorController) pollNeedDispatchRegion() (r *core.RegionInfo, next
return nil, false
}

// pushs with new notify time.
// pushes with new notify time.
item.time = oc.getNextPushOperatorTime(step, now)
heap.Push(&oc.opNotifierQueue, item)
return r, true
}

// PushOperators periodically pushs the unfinished operator to the excutor(TiKV).
// PushOperators periodically pushes the unfinished operator to the executor(TiKV).
func (oc *OperatorController) PushOperators() {
for {
r, next := oc.pollNeedDispatchRegion()
if r == nil && !next {
break
}
if r == nil {
if !next {
break
}
continue
}

oc.Dispatch(r, DispatchFromNotifierQueue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/schedule/operator_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (t *testOperatorControllerSuite) TestPollDispatchRegion(c *C) {
op2 := NewOperator("test", 2, &metapb.RegionEpoch{}, OpRegion, steps...)
region1 := tc.GetRegion(1)
region2 := tc.GetRegion(2)
// Adds operator and pushs to the notifier queue.
// Adds operator and pushes to the notifier queue.
{
oc.SetOperator(op1)
oc.SetOperator(op2)
Expand Down

0 comments on commit 7608f63

Please sign in to comment.