File tree Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,6 @@ final class DefaultWorkerFactory implements WorkerFactory
14
14
{
15
15
public const SCRIPT_PATH = __DIR__ . "/Internal/task-runner.php " ;
16
16
17
- private ?ContextFactory $ contextFactory ;
18
-
19
17
/**
20
18
* @param string $cacheClass Name of class implementing {@see Cache} to instantiate in each worker. Defaults
21
19
* to {@see LocalCache}.
@@ -24,7 +22,7 @@ final class DefaultWorkerFactory implements WorkerFactory
24
22
*/
25
23
public function __construct (
26
24
private ?string $ bootstrapPath = null ,
27
- ?ContextFactory $ contextFactory = null ,
25
+ private ?ContextFactory $ contextFactory = null ,
28
26
private string $ cacheClass = LocalCache::class,
29
27
) {
30
28
$ this ->contextFactory = $ contextFactory ;
Original file line number Diff line number Diff line change @@ -21,12 +21,6 @@ final class DefaultWorkerPool implements WorkerPool
21
21
/** @var bool Indicates if the pool is currently running. */
22
22
private bool $ running = true ;
23
23
24
- /** @var int The maximum number of workers the pool should spawn. */
25
- private int $ limit ;
26
-
27
- /** @var WorkerFactory A worker factory to be used to create new workers. */
28
- private ?WorkerFactory $ factory ;
29
-
30
24
/** @var \SplObjectStorage A collection of all workers in the pool. */
31
25
private \SplObjectStorage $ workers ;
32
26
@@ -50,17 +44,14 @@ final class DefaultWorkerPool implements WorkerPool
50
44
*
51
45
* @throws \Error
52
46
*/
53
- public function __construct (int $ limit = self ::DEFAULT_WORKER_LIMIT , ?WorkerFactory $ factory = null )
54
- {
47
+ public function __construct (
48
+ private int $ limit = self ::DEFAULT_WORKER_LIMIT ,
49
+ private ?WorkerFactory $ factory = null ,
50
+ ) {
55
51
if ($ limit < 0 ) {
56
52
throw new \Error ("Maximum size must be a non-negative integer " );
57
53
}
58
54
59
- $ this ->limit = $ limit ;
60
-
61
- // Use the global factory if none is given.
62
- $ this ->factory = $ factory ;
63
-
64
55
$ this ->workers = new \SplObjectStorage ;
65
56
$ this ->idleWorkers = new \SplQueue ;
66
57
You can’t perform that action at this time.
0 commit comments