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

View File

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