Compare commits

..

No commits in common. "2a60a6afffd676a9d0d899ba968eaa86fa8773be" and "4c1234291af815ec28cae1ffca1c844b35eb42a7" have entirely different histories.

3 changed files with 4 additions and 8 deletions

View File

@ -188,10 +188,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if channel == "" {
feeds, err := h.backend.Search(query)
if err != nil {
respondJSON(w, map[string]interface{}{
"query": query,
"error": err.Error(),
})
http.Error(w, err.Error(), 500)
return
}
respondJSON(w, map[string][]microsub.Feed{
@ -200,10 +197,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} else {
items, err := h.backend.ItemSearch(channel, query)
if err != nil {
respondJSON(w, map[string]interface{}{
"query": query,
"error": err.Error(),
})
http.Error(w, err.Error(), 500)
return
}
respondJSON(w, map[string]interface{}{

View File

@ -217,6 +217,7 @@ ON CONFLICT ON CONSTRAINT "items_uid_key" DO NOTHING
return false, err
}
log.Printf("AddItem: rows affected %d\n", c)
return c > 0, nil
}

View File

@ -31,6 +31,7 @@ type Backend interface {
// Create creates a channel of the specified type. Return nil when the type
// is not known.
func Create(channel, timelineType string, pool *redis.Pool, db *sql.DB) Backend {
log.Printf("fetching timeline with type %s", timelineType)
if timelineType == "sorted-set" {
timeline := &redisSortedSetTimeline{channel: channel, pool: pool}
err := timeline.Init()