...
 
Commits (2)
......@@ -39,7 +39,11 @@ class Expire
}
if ($this->boost->getState() == 'completed') {
return true; //already completed
// Re-sync ElasticSearch
$this->manager->resync($this->boost);
// Already completed
return true;
}
$this->boost->setCompletedTimestamp(round(microtime(true) * 1000));
......
......@@ -123,7 +123,11 @@ class Manager
public function update($boost, $fields = [])
{
$this->repository->update($boost, $fields);
$this->elasticRepository->update($boost, $fields);
$this->resync($boost, $fields);
}
public function resync($boost, $fields = [])
{
$this->elasticRepository->update($boost, $fields);
}
}
......@@ -258,6 +258,14 @@ class ManagerSpec extends ObjectBehavior
$this->elasticRepository->update($boost, [ '@timestamp' ])
->shouldBeCalled();
$this->update($boost, [ '@timestamp'] );
$this->update($boost, [ '@timestamp' ] );
}
function it_should_resync_a_boost_on_elasticsearch(Boost $boost)
{
$this->elasticRepository->update($boost, [ '@timestamp' ])
->shouldBeCalled();
$this->resync($boost, [ '@timestamp' ] );
}
}