Sort ascending
This commit is contained in:
parent
6477288fee
commit
7baf3a9ce5
|
|
@ -252,7 +252,7 @@ func (b *memoryBackend) TimelineGet(after, before, channel string) microsub.Time
|
||||||
|
|
||||||
channelKey := fmt.Sprintf("channel:%s:posts", channel)
|
channelKey := fmt.Sprintf("channel:%s:posts", channel)
|
||||||
|
|
||||||
itemJsons, err := redis.ByteSlices(b.Redis.Do("SORT", channelKey, "BY", "*->Published", "GET", "*->Data", "DESC", "ALPHA"))
|
itemJsons, err := redis.ByteSlices(b.Redis.Do("SORT", channelKey, "BY", "*->Published", "GET", "*->Data", "ASC", "ALPHA"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return microsub.Timeline{
|
return microsub.Timeline{
|
||||||
|
|
@ -267,13 +267,6 @@ func (b *memoryBackend) TimelineGet(after, before, channel string) microsub.Time
|
||||||
items = append(items, item)
|
items = append(items, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort.SliceStable(items, func(a, b int) bool {
|
|
||||||
// timeA := items[a].Published
|
|
||||||
// timeB := items[b].Published
|
|
||||||
// return strings.Compare(timeA, timeB) > 0
|
|
||||||
// })
|
|
||||||
// reverseSlice(items)
|
|
||||||
|
|
||||||
return microsub.Timeline{
|
return microsub.Timeline{
|
||||||
Paging: microsub.Pagination{},
|
Paging: microsub.Pagination{},
|
||||||
Items: items,
|
Items: items,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user