Skip to content

Commit b5ad2db

Browse files
committed
Fix count
1 parent 61993b9 commit b5ad2db

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/Entity/Job.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class Job
5656

5757
private ?int $count = 0;
5858

59+
private ?int $exceptionCount = 0;
60+
5961
private ?array $exceptions = null;
6062

6163
private ?\DateTimeInterface $startTime = null;
@@ -94,6 +96,7 @@ public static function createFromArray(array $datas)
9496
$job->setRequestedDate($datas['requested_date']);
9597
$job->setScheduledDataflowId($datas['scheduled_dataflow_id'] === null ? null : (int) $datas['scheduled_dataflow_id']);
9698
$job->setCount($datas['count'] === null ? null : (int) $datas['count']);
99+
$job->setExceptionCount($datas['exception_count']);
97100
$job->setExceptions($datas['exceptions']);
98101
$job->setStartTime($datas['start_time']);
99102
$job->setEndTime($datas['end_time']);
@@ -112,6 +115,7 @@ public function toArray(): array
112115
'requested_date' => $this->getRequestedDate(),
113116
'scheduled_dataflow_id' => $this->getScheduledDataflowId(),
114117
'count' => $this->getCount(),
118+
'exception_count' => $this->getExceptionCount(),
115119
'exceptions' => $this->getExceptions(),
116120
'start_time' => $this->getStartTime(),
117121
'end_time' => $this->getEndTime(),
@@ -214,6 +218,18 @@ public function setCount(?int $count): self
214218
return $this;
215219
}
216220

221+
public function getExceptionCount(): ?int
222+
{
223+
return $this->exceptionCount;
224+
}
225+
226+
public function setExceptionCount(?int $exceptionCount): self
227+
{
228+
$this->exceptionCount = $exceptionCount;
229+
230+
return $this;
231+
}
232+
217233
public function getExceptions(): ?array
218234
{
219235
return $this->exceptions;

src/Processor/JobProcessor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function process(Job $job): void
4545
$dataflowType->setRepository($this->repository);
4646
}
4747

48-
$handler = new StreamHandler(tempnam(sys_get_temp_dir(), 'dataflow_'));
48+
$handler = new StreamHandler(tempnam(sys_get_temp_dir(), 'dataflow_'), fileOpenMode: 'w+');
4949
$handler->setFormatter(new LineFormatter(self::FORMAT));
5050

5151
$loggers = [new Logger('dataflow_internal', [$bufferHandler = $handler])];
@@ -78,6 +78,7 @@ private function afterProcessing(Job $job, Result $result, StreamHandler $stream
7878
->setEndTime($result->getEndTime())
7979
->setStatus(Job::STATUS_COMPLETED)
8080
->setCount($result->getSuccessCount())
81+
->setExceptionCount($result->getErrorCount())
8182
;
8283

8384
if (!$this->exceptionHandler instanceof NullExceptionHandler) {

0 commit comments

Comments
 (0)