Repository navigation
Commit 0bcbec5
authored
fix: keep cache info of removed files when another file cannot be deleted (#541)
* fix: wait for cached files to be removed before deleting their cache info
The cleanup started removing files without waiting and then deleted the
cache info right away, so the cache info could be gone while the files
were still on disk. If the app was killed in between, those files were
left with nothing referencing them.
The cleanup now waits for the file removals first. The cache info of a
file that could not be removed is kept, so the next cleanup retries it.
* fix: keep cache info only of files that could not be removed
Move the partial-failure handling into _removeCachedFile so cleanup,
emptyCache and removeCachedFile all delete the cache info of removed files
and keep only the failed one. A failing deleteAll is logged instead of
replacing the file removal error.
---------
Co-authored-by: Jonathan Unsworth <17317065+junsworth@users.noreply.github.com>1 parent 071f1f3 commit 0bcbec5
4 files changed
Lines changed: 312 additions & 20 deletions
File tree
- flutter_cache_manager
- lib/src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
| 202 | + | |
202 | 203 | | |
| 204 | + | |
203 | 205 | | |
204 | 206 | | |
205 | | - | |
206 | 207 | | |
207 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
208 | 211 | | |
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
212 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
213 | 218 | | |
214 | 219 | | |
215 | | - | |
216 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
217 | 225 | | |
218 | 226 | | |
219 | 227 | | |
220 | 228 | | |
221 | | - | |
| 229 | + | |
| 230 | + | |
222 | 231 | | |
223 | | - | |
| 232 | + | |
224 | 233 | | |
225 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
226 | 237 | | |
227 | | - | |
228 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
229 | 243 | | |
230 | 244 | | |
231 | 245 | | |
| |||
234 | 248 | | |
235 | 249 | | |
236 | 250 | | |
237 | | - | |
238 | | - | |
239 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
240 | 293 | | |
241 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
242 | 298 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
247 | 305 | | |
248 | | - | |
249 | 306 | | |
250 | 307 | | |
251 | 308 | | |
| |||
260 | 317 | | |
261 | 318 | | |
262 | 319 | | |
| 320 | + | |
263 | 321 | | |
264 | 322 | | |
265 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments