Skip to content
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

Docker slow to respond #265

Open
skiwithpete opened this issue Nov 7, 2021 · 10 comments
Open

Docker slow to respond #265

skiwithpete opened this issue Nov 7, 2021 · 10 comments

Comments

@skiwithpete
Copy link

(thanks for updating the docker to .10)

Actions in Docker are taking a very long time to render. For example, smashing the [ key stops showing the change progress (from 3d to 7d for example) after a couple of presses and can take up to 10seconds to update. Then it takes an age to update the graph as well.

Another example is Shift+J or Shift+K taking 4 or 5 seconds for the graph to resize (whereas in earlier releases it was instantaneous).

I'm using on a 2019 i3 server, with a 2019 macbook pro in terminal.

Let me know what additional info I can provide to help find the cause.

Thanks,

Pete

@lyricnz
Copy link
Collaborator

lyricnz commented Nov 7, 2021

I am not experiencing this (docker on macbook pro). How are you running docker?

Screen.Recording.2021-11-08.at.9.53.11.am.mov

@lyricnz
Copy link
Collaborator

lyricnz commented Nov 7, 2021

I actually made a change recently #256 to improve the refresh after changing currencies. Seems quick here?

Screen.Recording.2021-11-08.at.9.54.39.am.mov

@skiwithpete
Copy link
Author

skiwithpete commented Nov 8, 2021

Actually, it happens in portfolio view. And then, when I leave Portfolio view, it affects the main page as well.

/edit -- I didn't do a screengrab, because it just looks like nothing is happening, and you can't see my keystrokes.
-- also I have different 11 coins in my portfolio. Some with just a few, and some lower cap ones with hundreds.

@lyricnz
Copy link
Collaborator

lyricnz commented Nov 8, 2021

I can see a problem with swapping back and forth to portfolio mode (at least since previous release). Raised #266 on that. But doesn't seem to be slow.

@skiwithpete
Copy link
Author

In portfolio mode pressing [ or ] doesn't go slow for you?

I'm running both a pretty powerful server and a powerful laptop...

Might be worth messing around with quantities of coins in your portfolio to see the problem I'm having.

@lyricnz
Copy link
Collaborator

lyricnz commented Nov 8, 2021

Yes, [ and ] are slow when you have lots of coins. It looks like it's fetching the history for each coin, one by one (with a 2 second delay between, to avoid coingecko rate limiting etc). Wasn't that always the case?

$ DEBUG=1 DEBUG_HTTP=1 ./bin/cointop
....
$ grep doReq /tmp/cointop.log  | grep days=7
time="2021-11-08T12:59:57+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/wrapped-bitcoin/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:00+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:02+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/ethereum/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:04+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/binancecoin/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:07+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/solana/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:10+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/litecoin/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:12+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/avalanche-2/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:14+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/polkadot/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:17+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/avaterra/market_chart?days=7&vs_currency=AUD"
time="2021-11-08T13:00:19+11:00" level=debug msg="doReq GET https://api.coingecko.com/api/v3/coins/binance-peg-xrp/market_chart?days=7&vs_currency=AUD"

@lyricnz
Copy link
Collaborator

lyricnz commented Nov 8, 2021

This delay has been in place for 3 years
https://github.com/cointop-sh/cointop/blame/master/cointop/chart.go#L255

@skiwithpete
Copy link
Author

skiwithpete commented Nov 8, 2021 via email

@lyricnz
Copy link
Collaborator

lyricnz commented Nov 8, 2021

It's not doing anything else at the time, from what I can tell. The 2-second delay is intended to avoid (coingecko) rate-limiting. It would be very easy to hit 50 requests/minute (their API limit) with a couple of range-changes across a large portfolio. There's an existing issue to investigate/tune/minimize this #228

@lyricnz
Copy link
Collaborator

lyricnz commented Nov 8, 2021

Maaaaaybe it would be possible to "fake" the new time range data (using the previous range, and dropping ~half the data), and update it in the background? Especially if moving to a shorter time range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants