Skip to content

Commit

Permalink
chore: separate out complete flag for 24h aggregates
Browse files Browse the repository at this point in the history
  • Loading branch information
xadahiya committed Aug 29, 2023
1 parent b22494e commit e8ee252
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,15 @@ async def compute(
msg_obj, redis, rpc_helper, anchor_rpc_helper, ipfs_reader, protocol_state_contract, project_id,
)

tail_epoch_id, _ = await get_tail_epoch_id(
tail_epoch_id, extrapolated_flag = await get_tail_epoch_id(
redis, protocol_state_contract, anchor_rpc_helper, msg_obj.epochId, 86400, msg_obj.projectId,
)

if extrapolated_flag:
aggregate_complete_flag = False
else:
aggregate_complete_flag = True

if project_last_finalized_epoch <= tail_epoch_id:
self._logger.error('last finalized epoch is too old, building aggregate from scratch')
return await self._calculate_from_scratch(
Expand Down Expand Up @@ -255,6 +260,7 @@ async def compute(
snapshot = UniswapTradesSnapshot.parse_obj(snapshot_data)
aggregate_snapshot = self._remove_aggregate_snapshot(aggregate_snapshot, snapshot)

if aggregate_complete_flag:
aggregate_snapshot.complete = True
else:
aggregate_snapshot.complete = False
Expand Down

0 comments on commit e8ee252

Please sign in to comment.