Restore Engrish function names to normal English.

This commit is contained in:
Eugene Bujak 2018-11-27 21:30:11 +03:00
parent 701fd10c1c
commit 70c5afd6a5
2 changed files with 9 additions and 11 deletions

4
app.go
View File

@ -156,7 +156,7 @@ func main() {
// Update filters we've just loaded right away, don't wait for periodic update timer
go func() {
checkFiltersUpdates(false)
refreshFiltersIfNeccessary(false)
// Save the updated config
err := writeConfig()
if err != nil {
@ -177,7 +177,7 @@ func main() {
address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
runFiltersUpdatesTimer()
go periodicallyRefreshFilters()
http.Handle("/", optionalAuthHandler(http.FileServer(box)))
registerControlHandlers()

View File

@ -471,7 +471,7 @@ func handleFilteringEnableURL(w http.ResponseWriter, r *http.Request) {
}
// kick off refresh of rules from new URLs
checkFiltersUpdates(false)
refreshFiltersIfNeccessary(false)
httpUpdateConfigReloadDNSReturnOK(w, r)
}
@ -527,22 +527,20 @@ func handleFilteringSetRules(w http.ResponseWriter, r *http.Request) {
func handleFilteringRefresh(w http.ResponseWriter, r *http.Request) {
force := r.URL.Query().Get("force")
updated := checkFiltersUpdates(force != "")
updated := refreshFiltersIfNeccessary(force != "")
fmt.Fprintf(w, "OK %d filters updated\n", updated)
}
// Sets up a timer that will be checking for filters updates periodically
func runFiltersUpdatesTimer() {
go func() {
for range time.Tick(time.Minute) {
checkFiltersUpdates(false)
}
}()
func periodicallyRefreshFilters() {
for range time.Tick(time.Minute) {
refreshFiltersIfNeccessary(false)
}
}
// Checks filters updates if necessary
// If force is true, it ignores the filter.LastUpdated field value
func checkFiltersUpdates(force bool) int {
func refreshFiltersIfNeccessary(force bool) int {
config.Lock()
// fetch URLs