scheduler: removing task IDs

These no longer serve any purpose that can't be replaced with a structure like Ds\Set, SplObjectStorage, or just using spl_object_id().
This commit is contained in:
Dylan K. Taylor
2020-07-08 12:01:48 +01:00
parent d738504e24
commit 6bca38999d
3 changed files with 2 additions and 26 deletions

View File

@ -49,9 +49,6 @@ class TaskScheduler{
*/
protected $tasks;
/** @var int */
private $ids = 1;
/** @var int */
protected $currentTick = 0;
@ -85,7 +82,6 @@ class TaskScheduler{
while(!$this->queue->isEmpty()){
$this->queue->extract();
}
$this->ids = 1;
}
public function isQueued(TaskHandler $task) : bool{
@ -110,7 +106,7 @@ class TaskScheduler{
$period = 1;
}
return $this->handle(new TaskHandler($task, $this->nextId(), $delay, $period, $this->owner));
return $this->handle(new TaskHandler($task, $delay, $period, $this->owner));
}
private function handle(TaskHandler $handler) : TaskHandler{
@ -159,8 +155,4 @@ class TaskScheduler{
private function isReady(int $currentTick) : bool{
return !$this->queue->isEmpty() and $this->queue->current()->getNextRun() <= $currentTick;
}
private function nextId() : int{
return $this->ids++;
}
}