()
| 1184 | } |
| 1185 | |
| 1186 | func (a *App) initAdBlockFilters() { |
| 1187 | if a.ctx == nil || a.filters == nil { |
| 1188 | return |
| 1189 | } |
| 1190 | go func() { |
| 1191 | ctx, cancel := context.WithTimeout(a.ctx, 2*time.Minute) |
| 1192 | defer cancel() |
| 1193 | if a.filters.NeedsUpdate() { |
| 1194 | if err := a.filters.Update(ctx, a.emitAdBlockProgress); err != nil { |
| 1195 | a.log.Warning(fmt.Sprintf("[ADBLOCK] Фоновое обновление баз: %v", err)) |
| 1196 | } else { |
| 1197 | a.log.Info("[ADBLOCK] Базы блокировки обновлены при запуске") |
| 1198 | } |
| 1199 | } |
| 1200 | }() |
| 1201 | a.startAdBlockFilterRefresh() |
| 1202 | } |
| 1203 | |
| 1204 | func (a *App) startAdBlockFilterRefresh() { |
| 1205 | if a.ctx == nil || a.filters == nil { |
no test coverage detected