fix(favicon): 失败重试间隔不再挡住"缓存文件丢失后的重抓"
实测:删掉 item-icons 里三个被污染的图标后,rebuild 不再重抓,图标永久缺失 (只有重启容器才恢复)。根因:faviconWorker 在**每次**尝试后都写 faviconAttempted, 而 queueFavicon 会用 faviconRetryGap 挡住"近期尝试过"的 host —— 于是 cachedFavicon() 为空(文件确实不存在)也照样被跳过。 修法:成功时 delete(faviconAttempted, hostport),只给失败保留节流记录。 这样缓存文件被手工清理或数据卷恢复后,下一次 rebuild 就能立即重抓。
This commit is contained in:
@ -208,7 +208,15 @@ func faviconWorker() {
|
||||
err := fetchFavicon(hostport)
|
||||
faviconMu.Lock()
|
||||
delete(faviconQueued, hostport)
|
||||
faviconAttempted[hostport] = time.Now()
|
||||
if err != nil {
|
||||
// 只给**失败**留节流记录
|
||||
faviconAttempted[hostport] = time.Now()
|
||||
} else {
|
||||
// 成功则不留下尝试记录:这样日后缓存文件被删(手工清理、数据卷恢复)时,
|
||||
// 下一次 rebuild 能立刻重抓,而不是被 faviconRetryGap 永久挡住
|
||||
// (实测踩到:删掉缓存的三个图标后一直不再抓,只有重启容器才会重抓)。
|
||||
delete(faviconAttempted, hostport)
|
||||
}
|
||||
faviconMu.Unlock()
|
||||
if err != nil {
|
||||
log.Printf("favicon: %s: %v", hostport, err)
|
||||
|
||||
Reference in New Issue
Block a user