fix slices.SortFunc() -- did the API change?

This commit is contained in:
fiatjaf
2023-11-08 17:43:16 -03:00
parent f1188a2112
commit 804a1f5253

View File

@@ -243,7 +243,7 @@ func authorLastNotes(ctx context.Context, pubkey string, relays []string, isSite
} }
// sort before returning // sort before returning
slices.SortFunc(lastNotes, func(a, b *nostr.Event) bool { return a.CreatedAt > b.CreatedAt }) slices.SortFunc(lastNotes, func(a, b *nostr.Event) int { return int(a.CreatedAt - b.CreatedAt) })
return lastNotes return lastNotes
} }
@@ -272,7 +272,7 @@ func relayLastNotes(ctx context.Context, relayUrl string, isSitemap bool) []*nos
}) })
} }
slices.SortFunc(lastNotes, func(a, b *nostr.Event) bool { return a.CreatedAt > b.CreatedAt }) slices.SortFunc(lastNotes, func(a, b *nostr.Event) int { return int(a.CreatedAt - b.CreatedAt) })
if len(lastNotes) > 0 { if len(lastNotes) > 0 {
cache.SetJSONWithTTL(key, lastNotes, time.Hour*24) cache.SetJSONWithTTL(key, lastNotes, time.Hour*24)
} }