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

避免在 Normal 模式下对同一张图片的多次网络请求 #698

Closed
4 of 5 tasks
FooIbar opened this issue Jan 19, 2023 · 10 comments
Closed
4 of 5 tasks

避免在 Normal 模式下对同一张图片的多次网络请求 #698

FooIbar opened this issue Jan 19, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@FooIbar
Copy link
Contributor

FooIbar commented Jan 19, 2023

需求 / Requirement

Normal 模式下缩略图是从长图裁剪而来的

而现有方式会对该图片进行重复请求

建议实现 / Suggested implements

coil-kt/coil#1461

备注 / Addition details

No response

EhViewer 版本号 / EhViewer version code

1.8.5.3-alpha06

EhViewer CI 版本 / EhViewer CI Version

https://github.com/Ehviewer-Overhauled/Ehviewer/actions/runs/3949284136

自查步骤 / Verify steps

  • 如果您有足够的时间和能力,并愿意为此提交 PR ,请勾上此复选框 / Pull request is welcome. Check this if you want to start a pull request
  • 您已仔细查看并知情 Q&A 中的内容 / You have checked Q&A carefully
  • 您已搜索过 Issue Tracker,没有找到类似内容 / I have searched on Issue Tracker, No duplicate or related open issue has been found
  • 您确保这个 Issue 只提及一个功能。如果您有多个功能请求,烦请发起多个 Issue / Ensure there is only one feature request in this issue. Please make mutiply issue for mutiply feature request
  • 您确保已使用最新 CI 版本测试,并且该功能在最新 CI 版本中并未按照预期实现 / This feature don't implement correctly in latest CI version
@FooIbar FooIbar added the enhancement New feature or request label Jan 19, 2023
@FooIbar
Copy link
Contributor Author

FooIbar commented Jan 19, 2023

第一个请求拿到之后才有 cache
实际的请求数量小于缩略图数量但大于1

@asuka-mio
Copy link
Member

获取同一个对象是之前迁移到imagedecoder java api的事情 迁移到coil我还真没测试

@asuka-mio
Copy link
Member

确实得解决一下

@asuka-mio
Copy link
Member

应该是同一个对象 毕竟memory cache key是一样的

@FooIbar
Copy link
Contributor Author

FooIbar commented Jan 19, 2023

这个需求和coil那个issue的需求几乎是一模一样,不过他那边还没实现

@asuka-mio
Copy link
Member

asuka-mio commented Jan 19, 2023

我觉得可以改一下coil的httpurifetcher
然后维护一个hashmap 把发起请求的部分synchronize下 然后后面直接用suspendcancelablecoroutine去回调

@asuka-mio
Copy link
Member

我明天看看

@asuka-mio
Copy link
Member

格局还是小了 直接合并所有memory cache key相同的imagerequest得了

@asuka-mio
Copy link
Member

Ehviewer-Overhauled/coil@d6792c6
这个实现何如

@asuka-mio
Copy link
Member

我还没构建测试 不过意思就是大概这个意思 明天再测试

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants