Compare commits
2 Commits
4c1234291a
...
2a60a6afff
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a60a6afff | |||
| ec493be52d |
|
|
@ -188,7 +188,10 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if channel == "" {
|
if channel == "" {
|
||||||
feeds, err := h.backend.Search(query)
|
feeds, err := h.backend.Search(query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), 500)
|
respondJSON(w, map[string]interface{}{
|
||||||
|
"query": query,
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
respondJSON(w, map[string][]microsub.Feed{
|
respondJSON(w, map[string][]microsub.Feed{
|
||||||
|
|
@ -197,7 +200,10 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
items, err := h.backend.ItemSearch(channel, query)
|
items, err := h.backend.ItemSearch(channel, query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), 500)
|
respondJSON(w, map[string]interface{}{
|
||||||
|
"query": query,
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
respondJSON(w, map[string]interface{}{
|
respondJSON(w, map[string]interface{}{
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,6 @@ ON CONFLICT ON CONSTRAINT "items_uid_key" DO NOTHING
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("AddItem: rows affected %d\n", c)
|
|
||||||
return c > 0, nil
|
return c > 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ type Backend interface {
|
||||||
// Create creates a channel of the specified type. Return nil when the type
|
// Create creates a channel of the specified type. Return nil when the type
|
||||||
// is not known.
|
// is not known.
|
||||||
func Create(channel, timelineType string, pool *redis.Pool, db *sql.DB) Backend {
|
func Create(channel, timelineType string, pool *redis.Pool, db *sql.DB) Backend {
|
||||||
log.Printf("fetching timeline with type %s", timelineType)
|
|
||||||
if timelineType == "sorted-set" {
|
if timelineType == "sorted-set" {
|
||||||
timeline := &redisSortedSetTimeline{channel: channel, pool: pool}
|
timeline := &redisSortedSetTimeline{channel: channel, pool: pool}
|
||||||
err := timeline.Init()
|
err := timeline.Init()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user