Skip to content

Commit f5540ad

Browse files
author
Sergio García Prado
committed
ISSUE #367
* move streaming_mode management from `DatabaseClient` to `SnapshotReader`.
1 parent f323369 commit f5540ad

File tree

1 file changed

+7
-2
lines changed
  • packages/core/minos-microservice-aggregate/minos/aggregate/snapshots/pg

1 file changed

+7
-2
lines changed

packages/core/minos-microservice-aggregate/minos/aggregate/snapshots/pg/readers.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,10 @@ async def find_entries(
128128
qb = PostgreSqlSnapshotQueryBuilder(name, condition, ordering, limit, transaction_uuids, exclude_deleted)
129129
query, parameters = qb.build()
130130

131-
async for row in self.submit_query_and_iter(query, parameters, streaming_mode=streaming_mode):
132-
yield SnapshotEntry(*row)
131+
async_iterable = self.submit_query_and_iter(query, parameters)
132+
if streaming_mode:
133+
async for row in async_iterable:
134+
yield SnapshotEntry(*row)
135+
else:
136+
for row in [row async for row in async_iterable]:
137+
yield SnapshotEntry(*row)

0 commit comments

Comments
 (0)