-
Couldn't load subscription status.
- Fork 129
Coins Api #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| return bodies; | ||
| } | ||
|
|
||
| function sleep(ms: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this we already have defined sleep somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cant find a timeout/sleep anywhere else in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, there was sleep already here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove the price cache?
can you also cache mcap response?
| }; | ||
|
|
||
| const coinsApiKey = getEnvValue("COINS_API_KEY") | ||
| const bodySize = 2; // 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was test code should have reverted back to 100
| return res; | ||
| } catch { | ||
| await sleep(5_000 + 10_000 * Math.random()); | ||
| restCallWrapper(request, retries--, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing await, and why both recursive call and a while loop, should have been one or the other
| readKeys = readKeys.filter((PK: string) => { | ||
| if (timestamp !== "now") return true; | ||
| if (priceCache[PK]) { | ||
| aggregatedRes[PK] = { ...priceCache[PK], PK }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you read from the cache, but there is no code that sets to the cache
|
|
||
| const bodies = getBodies(readKeys, timestamp); | ||
| const tokenData: CoinsApiData[][] = []; | ||
| await runInPromisePool({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lot of code duplication between /prices and /mcaps call
No description provided.