bakito / adguardhome-sync

🛡️ Synchronize AdGuard Home config to replicas
Apache License 2.0
841 stars 36 forks source link

Continue on Error #179

Closed peterhanzlik closed 8 months ago

peterhanzlik commented 1 year ago

Hi,

when the sync at some item crashes (e.g. blocklist is obsolete and cannot be access any longer). the tool crashes and does not process any item further. It would be great if the tool will just throw an error for items that could not have been synced and continued to sync the other items.

Example: 2023-04-08T10:23:30.921Z ERROR sync sync/sync.go:241 Error syncing filters {"from": "synology.lan:8081", "to": "loxberry.lan:8081", "error": "400 Bad Request(Couldn't fetch filter from url https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_2_English/filter.txt: got status code 404, want 200\n)"} github.com/bakito/adguardhome-sync/pkg/sync.(*worker).syncTo /home/bakito/go/src/github.com/bakito/adguardhome-sync/pkg/sync/sync.go:241 github.com/bakito/adguardhome-sync/pkg/sync.(*worker).sync /home/bakito/go/src/github.com/bakito/adguardhome-sync/pkg/sync/sync.go:186 github.com/bakito/adguardhome-sync/pkg/sync.(*worker).handleSync /home/bakito/go/src/github.com/bakito/adguardhome-sync/pkg/sync/http.go:31 github.com/gin-gonic/gin.(*Context).Next /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1 /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102 github.com/gin-gonic/gin.(*Context).Next /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 github.com/gin-gonic/gin.(*Engine).handleHTTPRequest /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620 github.com/gin-gonic/gin.(*Engine).ServeHTTP /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576 net/http.serverHandler.ServeHTTP /home/bakito/.gimme/versions/go1.20.1.linux.amd64/src/net/http/server.go:2936 net/http.(*conn).serve /home/bakito/.gimme/versions/go1.20.1.linux.amd64/src/net/http/server.go:1995

bakito commented 1 year ago

@peterhanzlik Thank you for your request. I would have to think of a way to properly implement this.

bakito commented 8 months ago

A refactoring has stared after which this should be possible: https://github.com/bakito/adguardhome-sync/tree/sync-actions

bakito commented 8 months ago

implemented in https://github.com/bakito/adguardhome-sync/releases/tag/v0.5.4

Enable by defining env var CONTINUE_ON_ERROR=true