Compare commits

..

No commits in common. "877a87e21d34b514a0f70ea166e8e95e89e28125" and "91e9add76a02521a03b531b9794d297ff08269ec" have entirely different histories.

3 changed files with 7 additions and 9 deletions

View File

@ -157,7 +157,8 @@ func (timeline *redisSortedSetTimeline) AddItem(item microsub.Item) error {
data, err := json.Marshal(item)
if err != nil {
return fmt.Errorf("couldn't marshall item for redis: %s", err)
log.Printf("error while creating item for redis: %v\n", err)
return err
}
forRedis := redisItem{
@ -170,7 +171,7 @@ func (timeline *redisSortedSetTimeline) AddItem(item microsub.Item) error {
itemKey := fmt.Sprintf("item:%s", item.ID)
_, err = redis.String(conn.Do("HMSET", redis.Args{}.Add(itemKey).AddFlat(&forRedis)...))
if err != nil {
return fmt.Errorf("writing failed for item to redis: %v", err)
return fmt.Errorf("error while writing item for redis: %v", err)
}
readChannelKey := fmt.Sprintf("channel:%s:read", channel)
@ -185,12 +186,12 @@ func (timeline *redisSortedSetTimeline) AddItem(item microsub.Item) error {
score, err := time.Parse(time.RFC3339, item.Published)
if err != nil {
return fmt.Errorf("can't parse %s as time", item.Published)
return fmt.Errorf("error can't parse %s as time", item.Published)
}
_, err = redis.Int64(conn.Do("ZADD", zchannelKey, score.Unix()*1.0, itemKey))
if err != nil {
return fmt.Errorf("zadding failed item %s to channel %s for redis: %v", itemKey, zchannelKey, err)
return fmt.Errorf("error while zadding item %s to channel %s for redis: %v", itemKey, zchannelKey, err)
}
// FIXME: send message to events...

View File

@ -114,12 +114,10 @@ func simplifyToItem(itemType string, item map[string][]interface{}) microsub.Ite
case "checkin", "location":
author, _ := simplifyCard(v[0])
feedItem.Checkin = &author
case "name", "published", "updated", "url", "uid", "latitude", "longitude", "summary":
case "name", "published", "updated", "url", "uid", "latitude", "longitude":
if resultPtr := getScalarPtr(&feedItem, k); resultPtr != nil {
if len(v) >= 1 {
if value, ok := v[0].(string); ok {
*resultPtr = value
}
*resultPtr = v[0].(string)
}
}
case "photo":

View File

@ -71,7 +71,6 @@ type Item struct {
RepostOf []string `json:"repost-of,omitempty" mf2:"repost-of"`
InReplyTo []string `json:"in-reply-to,omitempty" mf2:"in-reply-to"`
Content *Content `json:"content,omitempty" mf2:"content"`
Summary string `json:"summary,omitempty" mf2:"summary"`
Latitude string `json:"latitude,omitempty" mf2:"latitude"`
Longitude string `json:"longitude,omitempty" mf2:"longitude"`
Checkin *Card `json:"checkin,omitempty" mf2:"checkin"`