Browse Source

Swap to an LRU cache set to 20MB

pull/83/head
Kegan Dougal 8 years ago
parent
commit
e088e11821
  1. 4
      src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

4
src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
"github.com/die-net/lrucache"
"github.com/gregjones/httpcache" "github.com/gregjones/httpcache"
"github.com/matrix-org/go-neb/database" "github.com/matrix-org/go-neb/database"
"github.com/matrix-org/go-neb/matrix" "github.com/matrix-org/go-neb/matrix"
@ -220,7 +221,8 @@ func itemToHTML(feed *gofeed.Feed, item gofeed.Item) matrix.HTMLMessage {
} }
func init() { func init() {
cachingClient = httpcache.NewMemoryCacheTransport().Client()
lruCache := lrucache.New(1024*1024*20, 0) // 20 MB cache, no max-age
cachingClient = httpcache.NewTransport(lruCache).Client()
types.RegisterService(func(serviceID, serviceUserID, webhookEndpointURL string) types.Service { types.RegisterService(func(serviceID, serviceUserID, webhookEndpointURL string) types.Service {
r := &rssBotService{ r := &rssBotService{
id: serviceID, id: serviceID,

Loading…
Cancel
Save