From 27c523ca7443ecd685c9b2f379a5f423ca77dc73 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 23 Jun 2022 15:09:56 -0400 Subject: [PATCH] Speedup: only load a "views worth" of datums on first query --- piker/data/marketstore.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/piker/data/marketstore.py b/piker/data/marketstore.py index 804a79f0..ee76ba1e 100644 --- a/piker/data/marketstore.py +++ b/piker/data/marketstore.py @@ -395,7 +395,12 @@ class Storage: ]: first_tsdb_dt, last_tsdb_dt = None, None - tsdb_arrays = await self.read_ohlcv(fqsn) + tsdb_arrays = await self.read_ohlcv( + fqsn, + # on first load we don't need to pull the max + # history per request size worth. + limit=3000, + ) log.info(f'Loaded tsdb history {tsdb_arrays}') if tsdb_arrays: @@ -413,6 +418,7 @@ class Storage: fqsn: str, timeframe: Optional[Union[int, str]] = None, end: Optional[int] = None, + limit: int = int(800e3), ) -> tuple[ MarketstoreClient, @@ -435,7 +441,7 @@ class Storage: # TODO: figure the max limit here given the # ``purepc`` msg size limit of purerpc: 33554432 - limit=int(800e3), + limit=limit, ) if timeframe is None: