Rebase on master
This commit is contained in:
@@ -1168,6 +1168,12 @@ func (m *Manager) SchedDiag(ctx context.Context, doSched bool) (interface{}, err
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *Manager) RemoveSchedRequest(ctx context.Context, sectorID abi.SectorID, tasktype sealtasks.TaskType, priority int) error {
|
||||
m.workLk.Lock()
|
||||
defer m.workLk.Unlock()
|
||||
return m.sched.RemoveRequest(ctx, sectorID, tasktype, priority)
|
||||
}
|
||||
|
||||
func (m *Manager) Close(ctx context.Context) error {
|
||||
m.windowPoStSched.schedClose()
|
||||
m.winningPoStSched.schedClose()
|
||||
|
||||
@@ -381,6 +381,22 @@ func (sh *Scheduler) Info(ctx context.Context) (interface{}, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func (sh *Scheduler) RemoveRequest(ctx context.Context, sectorID abi.SectorID, tasktype sealtasks.TaskType, priority int) error {
|
||||
if sh.SchedQueue.Len() < 0 {
|
||||
return xerrors.Errorf("No requests in the scheduler")
|
||||
}
|
||||
sh.workersLk.Lock()
|
||||
defer sh.workersLk.Unlock()
|
||||
queue := sh.SchedQueue
|
||||
for i, r := range *queue {
|
||||
if r.Sector.ID == sectorID && r.Priority == priority && r.TaskType == tasktype { // TODO: Add check to ensure request in not scheduled
|
||||
queue.Remove(i)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return xerrors.Errorf("No request with provided details found")
|
||||
}
|
||||
|
||||
func (sh *Scheduler) Close(ctx context.Context) error {
|
||||
close(sh.closing)
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user