[英]amphp/parallel-functions in Symfony
/** @var array<ServiceInterface> */
protected $services;
public function __construct(array $services)
{
$this->services = $services;
}
public function checkRkoDuplicates(Payload $payload)
{
$services = $this->services;
try {
$results = Promise\wait(parallelMap($services, function (ServiceInterface $service) use ($payload) {
return $service->exchange($payload); // ?string
}));
} catch (MultiReasonException $exception) {
foreach ($exception->getReasons() as $reason) {
var_dump($reason->getMessage());
}
return null;
}
return $results;
}
如果在 Symfony 中我使用 APP_ENV = dev 一切正常。 如果 APP_ENV = prod 然后我得到错误The given data could not be serialized: Serialization of 'Closure' is not allowed
。
为什么会发生? 如何使它工作?
Monolog 尝试将日志从服务写入 prod.log。 但是excluded_http_codes: [404, 405]
破坏了条目。 由于服务日志是单独存储的,我在 prod.log 中禁用了来自服务的日志
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.