diff --git a/http.go b/http.go index c05124a..c30694e 100644 --- a/http.go +++ b/http.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/gorilla/mux" "log" - "math" "net/http" "net/url" "os" @@ -27,12 +26,13 @@ func Serve() { fmt.Println(actor.feed, err.Error()) continue } - // Post or update latest 5 article - for _, article := range (*articles)[0:int(math.Min(float64(len(*articles)-1), 4))] { - err = actor.PostArticle(article) - if err != nil { - fmt.Println("Posting", article, "failed") - } + if len(*articles) < 1 { + fmt.Println(actor.feed, "Empty feed") + continue + } + err = actor.PostArticle((*articles)[0]) + if err != nil { + fmt.Println("Posting", (*articles)[0], "failed") } } }()