aboutsummaryrefslogtreecommitdiff
path: root/internal/feed
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-01 21:39:37 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-01 21:39:37 +0200
commit04a4897b69f9a10bdea27fb1133bcab71c40b687 (patch)
treedbe438199c33439d7731f9fc9e5d565ce0b6418b /internal/feed
parent9990266256b8859b3d500ff0fc0fcee6e1e64193 (diff)
downloadfeed2imap-go-04a4897b69f9a10bdea27fb1133bcab71c40b687.tar.gz
feed2imap-go-04a4897b69f9a10bdea27fb1133bcab71c40b687.tar.bz2
feed2imap-go-04a4897b69f9a10bdea27fb1133bcab71c40b687.zip
Config option 'max-failures'
Diffstat (limited to '')
-rw-r--r--internal/feed/cache.go2
-rw-r--r--internal/feed/cache_v1.go4
-rw-r--r--internal/feed/parse.go6
3 files changed, 8 insertions, 4 deletions
diff --git a/internal/feed/cache.go b/internal/feed/cache.go
index 0b2f905..f1dfb77 100644
--- a/internal/feed/cache.go
+++ b/internal/feed/cache.go
@@ -25,7 +25,7 @@ type Cache interface {
type CachedFeed interface {
Checked(withFailure bool)
- Failures() uint
+ Failures() int
Last() time.Time
filterItems(items []feeditem, ignoreHash bool, alwaysNew bool) []feeditem
Commit()
diff --git a/internal/feed/cache_v1.go b/internal/feed/cache_v1.go
index 37a4773..5f8c8f4 100644
--- a/internal/feed/cache_v1.go
+++ b/internal/feed/cache_v1.go
@@ -25,7 +25,7 @@ type v1Cache struct {
type cachedFeed struct {
LastCheck time.Time
currentCheck time.Time
- NumFailures uint // can't be named `Failures` b/c it'll collide with the interface
+ NumFailures int // can't be named `Failures` b/c it'll collide with the interface
Items []cachedItem
newItems []cachedItem
}
@@ -67,7 +67,7 @@ func (cf *cachedFeed) Commit() {
cf.LastCheck = cf.currentCheck
}
-func (cf *cachedFeed) Failures() uint {
+func (cf *cachedFeed) Failures() int {
return cf.NumFailures
}
diff --git a/internal/feed/parse.go b/internal/feed/parse.go
index fe3374a..1ce6cda 100644
--- a/internal/feed/parse.go
+++ b/internal/feed/parse.go
@@ -65,6 +65,10 @@ func handleFeed(feed *Feed) {
err := parseFeed(feed)
if err != nil {
- log.Error(err)
+ if feed.cached.Failures() >= feed.Global.MaxFailures {
+ log.Error(err)
+ } else {
+ log.Print(err)
+ }
}
}
>Use die function instead of boring if else everywhere.Jason A. Donenfeld1-69/+23 2014-04-24version: bump1.6.1Jason A. Donenfeld1-1/+1 2014-04-24Makefile: osx/bsd does not support -DJason A. Donenfeld2-25/+25 2014-04-24show: error out if password store is empty.Jason A. Donenfeld1-1/+4 2014-04-24find: proper segmenting of terms1.6Jason A. Donenfeld1-3/+3 2014-04-24dmenu: hide outputJason A. Donenfeld1-1/+1 2014-04-24tests: test for spacesJason A. Donenfeld3-8/+20 2014-04-24Move test instructions to INSTALL.Jason A. Donenfeld2-11/+18 2014-04-24tests: we don't use aggregate-resultsJason A. Donenfeld1-57/+0 2014-04-24Don't prompt for questions when stdin is not a tty.Jason A. Donenfeld3-7/+6 2014-04-24Allow overridable bash.Jason A. Donenfeld16-16/+16 2014-04-24dmenu: check for empty instead of ret codeJason A. Donenfeld1-1/+1 2014-04-24tests: sed doesn't like escaped chars on non-gnuJason A. Donenfeld1-1/+1 2014-04-24tests: run from anywhereJason A. Donenfeld13-4/+16 2014-04-24Turns out aliases were a bad idea.Jason A. Donenfeld14-95/+92 2014-04-24Make gpg_opts an array.Jason A. Donenfeld1-12/+12 2014-04-24Shellcheck errors.Jason A. Donenfeld1-6/+6 2014-04-24tests: todo updateJason A. Donenfeld1-25/+0