Add cli flag to reset all feed errors

This commit is contained in:
Frédéric Guillot 2018-06-30 14:22:45 -07:00
parent 9c0f882ba0
commit 5cf504745b
2 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,7 @@ func Parse() {
flagFlushSessions := flag.Bool("flush-sessions", false, "Flush all sessions (disconnect users)")
flagCreateAdmin := flag.Bool("create-admin", false, "Create admin user")
flagResetPassword := flag.Bool("reset-password", false, "Reset user password")
flagResetFeedErrors := flag.Bool("reset-feed-errors", false, "Clear all feed errors for all users")
flagDebugMode := flag.Bool("debug", false, "Enable debug mode (more verbose output)")
flag.Parse()
@ -52,6 +53,11 @@ func Parse() {
return
}
if *flagResetFeedErrors {
store.ResetFeedErrors()
return
}
if *flagFlushSessions {
flushSessions(store)
return

View File

@ -273,3 +273,9 @@ func (s *Storage) RemoveFeed(userID, feedID int64) error {
return nil
}
// ResetFeedErrors removes all feed errors.
func (s *Storage) ResetFeedErrors() error {
_, err := s.db.Exec(`UPDATE feeds SET parsing_error_count=0, parsing_error_msg=''`)
return err
}