harmony-one / staking-dashboard

Repo for harmony staking dashboard
39 stars 39 forks source link

Fix loading avatar images by request by batch #701

Closed kerto07 closed 1 year ago

kerto07 commented 1 year ago

Too many http requests are done at the same time to get the avatar images, instead I do the same by batch of 50 so it is not too much. Also there were issues with special characters in the url for keybase, I passed the query string parameters in qs variable to fix that

potvik commented 1 year ago

Take a closer look - in the current version, avatars are loaded in turn one at a time

image

We deliberately did not loading with batches in order not to load the api and avoid unsuccessful requests

potvik commented 1 year ago

Also there were issues with special characters in the url for keybase, I passed the query string parameters in qs variable to fix that - Yes, that's great! Let's use it

kerto07 commented 1 year ago
image

Actually it doesn't load one at a time because there is no await when calling cacheAvatar()

I tried before with the await cacheAvatar(), it worked but it was slow, so I loaded by batch. If it is ok to be a bit slow, then we can just add the await when calling cacheAvatar(), it will fixes some network issues

potvik commented 1 year ago

Yes, it looks like a missing await - will need to add await before cacheAvatar

sophoah commented 1 year ago

@potvik if no issue with batch load why not using it ?

potvik commented 1 year ago

@kerto07 @sophoah we can decrease batch to 10.. i think it should be ok. Another way - return to base version. and add await before cache.