Skip to content

Commit

Permalink
Set POLLING_DB_SELECT_LIMIT from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
ktogias committed Sep 21, 2022
1 parent 258bb56 commit a21051d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dev/Infrastructure/Event/Adapter/Postgres/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Store implements EventStore
";

protected const SELECT_UNDISPATCHED_EVENTS_SQL = "
SELECT * FROM event AS NEW where NEW.dispatched = false %%filter_matcher%% ORDER BY id LIMIT 10000;
SELECT * FROM event AS NEW where NEW.dispatched = false %%filter_matcher%% ORDER BY id LIMIT %%polling_select_limit%%;
";

protected const LISTEN_TIMEOUT = 60*10000;
Expand Down Expand Up @@ -76,7 +76,7 @@ public function listen(Dispatcher $dispatcher):void{
public function dispatchAllUndispatched(Dispatcher $dispatcher):void
{
$data = $this->con
->query(str_replace("%%filter_matcher%%", $this->getFilterMatcher(), SELF::SELECT_UNDISPATCHED_EVENTS_SQL), \PDO::FETCH_ASSOC)
->query(str_replace("%%polling_select_limit%%", (getenv('POLLING_DB_SELECT_LIMIT') ?: '10000'), str_replace("%%filter_matcher%%", $this->getFilterMatcher(), SELF::SELECT_UNDISPATCHED_EVENTS_SQL)), \PDO::FETCH_ASSOC)
->fetchAll();
foreach ($data as $eventData){
$eventData['data'] = json_decode($eventData['data'], true);
Expand Down

0 comments on commit a21051d

Please sign in to comment.