Only post latest article
This commit is contained in:
parent
6edfd4e02b
commit
c0594e4e04
14
http.go
14
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")
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
Reference in New Issue