linux-command icon indicating copy to clipboard operation
linux-command copied to clipboard

关闭wifi为什么搜索返回会变快?

Open algking opened this issue 6 years ago • 5 comments

在本机部署了一个,把index.js 里面的fetch url改成了本地的地址 但是发现有wifi的时候,afred搜素返回很慢,要好几秒 但是关掉wifi后就正常了

alfy.fetch('http://linuxcmd.com/data.json',
           {maxAge: 86400000}).then(result => {
    var commands = [];
    var e = 0;
    for(var a in result){
      ++e;
      result[a]['id'] = e;
      commands.push(result[a]);
...

algking avatar Apr 04 '18 04:04 algking

@algking 我不使用afred不太清楚,当初是看官方实例开发的,你可以研究一下。

jaywcjlove avatar Apr 04 '18 05:04 jaywcjlove

看了下代码,还有afry库,实在想不明白...我再看看,谢谢

algking avatar Apr 04 '18 07:04 algking

还是要看alfy的代码,里面的fetch支持cache选项,但ta的fecth的options需要参考https://github.com/sindresorhus/got#options 也就是https.request的options 有网时优先从网络获取,离线时从cache中获取

zuoRambo avatar Jan 11 '19 13:01 zuoRambo

@zuoRambo 👍

jaywcjlove avatar Jan 11 '19 14:01 jaywcjlove

@algking 现在不用走网络了,配置本地化了,搜索起来倍儿快。

https://github.com/jaywcjlove/linux-command/releases/tag/v1.2.2

Download Linux Command for Alfred v1.2.2

jaywcjlove avatar Apr 12 '19 15:04 jaywcjlove