Skip to content

Commit

Permalink
Merge pull request #44 from DmitryFurs/fix-broken-cron-job-count-aggr…
Browse files Browse the repository at this point in the history
…egator

Fix BrokenCronJobCountAggregator
  • Loading branch information
DavidLambauer authored Nov 7, 2024
2 parents 89e3241 + 7007200 commit d092414
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ public function testAggregate()
{
$this->collection
->expects($this->at(0))
->method('addFilter')
->method('addFieldToFilter')
->with(...['status', 'pending'])
->willReturn($this->collection);
$this->collection
->expects($this->at(1))
->method('addFilter')
->with(...['executed_at', 'NULL', 'IS NOT'])
->method('addFieldToFilter')
->with(...['executed_at', ['notnull' => true]])
->willReturn($this->collection);
$this->collection
->expects($this->at(2))
->method('addFilter')
->with(...['finished_at', 'NULL', 'IS'])
->method('addFieldToFilter')
->with(...['finished_at', ['null' => true]])
->willReturn($this->collection);

$this->collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CronJobCountAggregatorTest extends TestCase
/** @var MockObject|Collection */
private $collection;

/** @var BrokenCronJobCountAggregator */
/** @var CronJobCountAggregator */
private $sut;

public function setUp(): void
Expand Down
6 changes: 3 additions & 3 deletions src/Aggregator/CronJob/BrokenCronJobCountAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public function aggregate(): bool
{
/** @var Collection $collection */
$collection = $this->cronCollectionFactory->create();
$collection->addFilter('status', Schedule::STATUS_PENDING)
->addFilter('executed_at', 'NULL', 'IS NOT')
->addFilter('finished_at', 'NULL', 'IS');
$collection->addFieldToFilter('status', Schedule::STATUS_PENDING)
->addFieldToFilter('executed_at', ['notnull' => true])
->addFieldToFilter('finished_at', ['null' => true]);
$this->updateMetricService->update($this->getCode(), (string)$collection->count());

return true;
Expand Down

0 comments on commit d092414

Please sign in to comment.