Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

lazy load star pages #14

Open
meritozh opened this issue Jun 6, 2019 · 4 comments
Open

lazy load star pages #14

meritozh opened this issue Jun 6, 2019 · 4 comments
Labels
🐛 bug Something isn't working question Further information is requested

Comments

@meritozh
Copy link

meritozh commented Jun 6, 2019

拉取star列表时,希望一页一页拉取,而不是现在一次拉取所有页。star太多,一次拉取会触发GitHub的API滥用防御

@lvxianchao
Copy link
Owner

@meritozh 好问题,但是如果一页一页拉取的话,在过滤的时候就需要到 Github 上去搜索了,响应速度不会像现在这样快。我看到你 Star 过的数量有 7K+,你在使用的时候是收到了 Github API 的滥用防御了吗?

@lvxianchao lvxianchao added the question Further information is requested label Jun 6, 2019
@meritozh
Copy link
Author

meritozh commented Jun 6, 2019

@lvxianchao 是的,正是因为star太多才想来管理下。Dev Tools 的 network panel 里后面的一些请求,response 里显示的就是滥用被防御了。

抛砖引玉,比如 page < 5 时,可以就保持现在的逻辑,一次同时拉取所有页,否则可以按照一次拉 5 页,然后用户点击 load 再拉下 5 页。看起来只要请求不是太频繁就不会被防御。

顺便问一下,是不是拉取一次后,这些数据都会被本地存储起来?

@lvxianchao
Copy link
Owner

lvxianchao commented Jun 6, 2019

是的,在拉取所有的 Star 项目后,项目的数据会通过 Chrome 的 Storage API 存储起来(实际上也是本地存储,只不过是另一个种 API),所以在使用各种条件过滤时才会响应迅速。

如果按照你提到的思路,在使用条件过滤时前不能过滤全部,或者需要强制让用户把所有数据都一次次加载到本地才可以做到过滤的时候没有漏掉的数据,不然会缺失,所以感觉不是很合适。

针对这个问题,我现在的想法是想办法找到一个方法,每次开启插件的时候做一次请求,然后能够对比一下之前的状态,只拉取有变动的项目,这样会节省很多带宽并且响应变得更快速,但是至今我都没找到什么办法能做到这个对比。

So,很抱歉,我恐怕不够很快解决这个问题,但我会尽力的,如果你有什么好的思路想法十分欢迎在这里交流哈~

@lvxianchao lvxianchao added the 🐛 bug Something isn't working label Jun 6, 2019
@lvxianchao
Copy link
Owner

lvxianchao commented Jun 8, 2019

@meritozh 你可以提供给我一个用于追踪问题的 TOKEN 吗?如果你同意的话,可以通过 coderlxc@gmail.com 这个邮箱发送给我。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants