duality-labs / hapi-indexer

A Node.js based indexer for the Duality Cosmos chain
1 stars 0 forks source link

Abstract out stat and time-series responses into new continuous updates framework #37

Closed dib542 closed 11 months ago

dib542 commented 1 year ago

Issue

Get /stats and /timeseries endpoints to use long-polling.ts and server-sent-events.ts from issue

Solution

general fixes

for getPrice.ts and getTotalVolume.ts

optional fixes

specific fixes required

The inner part of the methods can be cached (with block_range.from_height and block_range.to_height vars). this could be done with caches and cacheIDs of:

A different, maybe cleaner solution would be to put caches inside another cache which seems bad? like this:

this seems a little cleaner but maybe bad practice, the inner caches would have to be global caches.