Skip to content

Commit cd3b960

Browse files
committed
setter
1 parent 17efc3f commit cd3b960

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/Queue/Server.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ public function __construct(Adapter $adapter, ?Container $container = null)
8383
$this->setTelemetry(new NoTelemetry());
8484
}
8585

86+
/**
87+
* Enable or disable coroutine mode for concurrent job processing.
88+
*
89+
* When enabled, each coroutine gets its own child container via
90+
* Swoole\Coroutine::getContext(), preventing shared state between
91+
* concurrent jobs. Must be called before start().
92+
*
93+
* @param bool $enable
94+
* @return self
95+
*/
96+
public function setCoroutines(bool $enable): self
97+
{
98+
$this->coroutines = $enable;
99+
return $this;
100+
}
101+
86102
public function job(): Job
87103
{
88104
$this->job = new Job();

0 commit comments

Comments
 (0)