Skip to content

Commit

Permalink
Pg/page by logindex (#10738)
Browse files Browse the repository at this point in the history
* Page through logs by logPosition

* Fix variable name and add logPosition to query

Co-authored-by: Paul Gebheim <[email protected]>
Co-authored-by: Paul Gebheim <[email protected]>
  • Loading branch information
3 people authored Mar 1, 2021
1 parent c4c0119 commit 49d8870
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/augur-sdk/src/graph/GraphQLLogProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const eventFields = {
"cancelZeroXOrder": ["universe", "market", "account", "outcome", "price", "amount", "orderType", "orderHash"]
}

const GENERIC_LOG_FIELDS = ["name", "blockNumber", "logIndex"];
const GENERIC_LOG_FIELDS = ["name", "blockNumber", "logIndex", "logPosition"];

const entityPluralSuffix = 'Events';

Expand All @@ -71,7 +71,7 @@ function buildQuery(fromBlockNumber: number, toBlockNumber: number, logFieldDesc

// When a particular entity type has no more logs to fetch it is removed from
// `lastLogPositions` -- which means that we can skip it when fetching
if(typeof lastLogPositions === "undefined") continue;
if(typeof lastLogPosition === "undefined") continue;

const fields = GENERIC_LOG_FIELDS.concat(eventFields);
eventQueries += `${entityName}(where: { blockNumber_gte: ${fromBlockNumber}, blockNumber_lte: ${toBlockNumber}, logPosition_gt: ${JSON.stringify(lastLogPosition)}}, first: 1000) {\n${fields.join(",\n")}}\n`;
Expand Down

0 comments on commit 49d8870

Please sign in to comment.