File tree 3 files changed +12
-3
lines changed
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 34
34
"require" : {
35
35
"amphp/amp" : " ^2" ,
36
36
"amphp/byte-stream" : " ^1" ,
37
- "amphp/parallel" : " ^0.1.5 "
37
+ "amphp/parallel" : " ^0.1.8 "
38
38
},
39
39
"require-dev" : {
40
40
"amphp/phpunit-util" : " ^1" ,
Original file line number Diff line number Diff line change 12
12
*
13
13
* @internal
14
14
*/
15
- class FileTask extends BlockingDriver implements Task {
15
+ class FileTask implements Task {
16
16
const ENV_PREFIX = self ::class . '# ' ;
17
17
18
18
/** @var string */
@@ -142,7 +142,7 @@ public function run(Environment $environment) {
142
142
case "ctime " :
143
143
case "get " :
144
144
case "put " :
145
- return ([$ this , $ this ->operation ])(...$ this ->args );
145
+ return ([new BlockingDriver , $ this ->operation ])(...$ this ->args );
146
146
147
147
default :
148
148
throw new \Error ("Invalid operation " );
Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ function filesystem(Driver $driver = null): Driver {
22
22
23
23
$ driver = driver ();
24
24
}
25
+
26
+ if (\defined ("AMP_WORKER " ) && $ driver instanceof ParallelDriver) {
27
+ throw new \Error ("Cannot use the parallel driver within a worker " );
28
+ }
29
+
25
30
Loop::setState (LOOP_STATE_IDENTIFIER , $ driver );
26
31
return $ driver ;
27
32
}
@@ -46,6 +51,10 @@ function driver(): Driver {
46
51
return new BlockingDriver ;
47
52
}
48
53
54
+ if (\defined ("AMP_WORKER " )) { // Prevent spawning infinite workers.
55
+ return new BlockingDriver ;
56
+ }
57
+
49
58
return new ParallelDriver ;
50
59
}
51
60
You can’t perform that action at this time.
0 commit comments