- filters: auto-update didn't work
This commit is contained in:
parent
c6b4e269ed
commit
e2ff8628ad
@ -230,6 +230,8 @@ func startDNSServer() error {
|
|||||||
return errorx.Decorate(err, "Couldn't start forwarding DNS server")
|
return errorx.Decorate(err, "Couldn't start forwarding DNS server")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startFiltering()
|
||||||
|
|
||||||
const topClientsNumber = 100 // the number of clients to get
|
const topClientsNumber = 100 // the number of clients to get
|
||||||
topClients := config.stats.GetTopClientsIP(topClientsNumber)
|
topClients := config.stats.GetTopClientsIP(topClientsNumber)
|
||||||
for _, ip := range topClients {
|
for _, ip := range topClients {
|
||||||
|
@ -28,6 +28,12 @@ func initFiltering() {
|
|||||||
loadFilters()
|
loadFilters()
|
||||||
deduplicateFilters()
|
deduplicateFilters()
|
||||||
updateUniqueFilterID(config.Filters)
|
updateUniqueFilterID(config.Filters)
|
||||||
|
}
|
||||||
|
|
||||||
|
func startFiltering() {
|
||||||
|
// Here we should start updating filters,
|
||||||
|
// but currently we can't wake up the periodic task to do so.
|
||||||
|
// So for now we just start this periodic task from here.
|
||||||
go periodicallyRefreshFilters()
|
go periodicallyRefreshFilters()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +184,7 @@ func assignUniqueFilterID() int64 {
|
|||||||
// Sets up a timer that will be checking for filters updates periodically
|
// Sets up a timer that will be checking for filters updates periodically
|
||||||
func periodicallyRefreshFilters() {
|
func periodicallyRefreshFilters() {
|
||||||
for {
|
for {
|
||||||
if config.DNS.FiltersUpdateIntervalHours != 0 && refreshStatus != 0 {
|
if config.DNS.FiltersUpdateIntervalHours != 0 && refreshStatus == 0 {
|
||||||
refreshStatus = 1
|
refreshStatus = 1
|
||||||
refreshLock.Lock()
|
refreshLock.Lock()
|
||||||
_ = refreshFiltersIfNecessary(false)
|
_ = refreshFiltersIfNecessary(false)
|
||||||
|
Loading…
Reference in New Issue
Block a user