Compare commits

..

2 Commits

Author SHA1 Message Date
2a60a6afff
Remove logging lines
Some checks failed
continuous-integration/drone/push Build is failing
2021-06-05 20:03:06 +02:00
ec493be52d
Respond with error when searching 2021-06-05 20:02:46 +02:00
3 changed files with 8 additions and 4 deletions

View File

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

View File

@ -217,7 +217,6 @@ 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,7 +31,6 @@ 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()