mirror of
https://github.com/makeworld-the-better-one/amfora.git
synced 2024-11-25 22:53:02 +03:00
🚧 Allow caching, increase curDay initial"
This commit is contained in:
parent
0a963a0d8d
commit
781b89af61
3
cache/page.go
vendored
3
cache/page.go
vendored
@ -3,7 +3,6 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/makeworld-the-better-one/amfora/structs"
|
||||
@ -47,7 +46,7 @@ func removeURL(url string) {
|
||||
// If your page is larger than the max cache size, the provided page
|
||||
// will silently not be added to the cache.
|
||||
func AddPage(p *structs.Page) {
|
||||
if p.URL == "" || strings.HasPrefix(p.URL, "about:") {
|
||||
if p.URL == "" {
|
||||
// Just in case, these pages shouldn't be cached
|
||||
return
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ func toLocalDay(t time.Time) time.Time {
|
||||
|
||||
// Feeds displays the feeds page on the current tab.
|
||||
func Feeds(t *tab) {
|
||||
// Retrieve cached version if there hasn't been updates
|
||||
// Retrieve cached version if there hasn't been any updates
|
||||
p, ok := cache.GetPage("about:feeds")
|
||||
if feedPageUpdated.After(feeds.LastUpdated) && ok {
|
||||
setPage(t, p)
|
||||
@ -35,10 +35,14 @@ func Feeds(t *tab) {
|
||||
|
||||
// curDay represents what day of posts the loop is on.
|
||||
// It only goes backwards in time.
|
||||
// It's initial setting means:
|
||||
// Only display posts older than 6 hours in the future,
|
||||
// nothing further in the future.
|
||||
curDay := toLocalDay(time.Now()).Add(6 * time.Hour)
|
||||
// Its initial setting means:
|
||||
// Only display posts older than 26 hours in the future, nothing further in the future.
|
||||
//
|
||||
// 26 hours was chosen because it is the largest timezone difference
|
||||
// currently in the world. Posts may be dated in the future
|
||||
// due to software bugs, where the local user's date is used, but
|
||||
// the UTC timezone is specified. I believe gemfeed does this.
|
||||
curDay := toLocalDay(time.Now()).Add(26 * time.Hour)
|
||||
|
||||
pe := feeds.GetPageEntries()
|
||||
|
||||
|
@ -329,6 +329,5 @@ func GetPageEntries() *PageEntries {
|
||||
data.RUnlock()
|
||||
|
||||
sort.Sort(&pe)
|
||||
|
||||
return &pe
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user