diff --git a/cmd/eksterd/app.go b/cmd/eksterd/app.go index 72a5ce9..d02c015 100644 --- a/cmd/eksterd/app.go +++ b/cmd/eksterd/app.go @@ -52,20 +52,13 @@ func NewApp(options AppOptions) (*App, error) { app.backend.Me = "https://p83.nl/" app.backend.AuthEnabled = options.AuthEnabled - app.backend.baseURL = options.BaseURL - - // FIXME: circular - app.backend.hubIncomingBackend.pool = options.pool - app.backend.hubIncomingBackend.baseURL = options.BaseURL - app.backend.hubIncomingBackend.backend = app.backend app.hubBackend = &hubIncomingBackend{ - backend: app.backend, baseURL: options.BaseURL, pool: options.pool, database: options.database, } - app.backend.hubIncomingBackend = *app.hubBackend + app.backend.hubBackend = app.hubBackend http.Handle("/micropub", µpubHandler{ Backend: app.backend, diff --git a/cmd/eksterd/hubbackend.go b/cmd/eksterd/hubbackend.go index e90c382..a18891e 100644 --- a/cmd/eksterd/hubbackend.go +++ b/cmd/eksterd/hubbackend.go @@ -29,7 +29,6 @@ type HubBackend interface { } type hubIncomingBackend struct { - backend *memoryBackend baseURL string pool *redis.Pool database *sql.DB diff --git a/cmd/eksterd/memory.go b/cmd/eksterd/memory.go index b0e238d..31bd961 100644 --- a/cmd/eksterd/memory.go +++ b/cmd/eksterd/memory.go @@ -40,8 +40,6 @@ func init() { const DefaultPrio = 9999999 type memoryBackend struct { - hubIncomingBackend - lock sync.RWMutex Channels map[string]microsub.Channel Feeds map[string][]microsub.Feed @@ -57,6 +55,8 @@ type memoryBackend struct { broker *sse.Broker + hubBackend HubBackend + pool *redis.Pool database *sql.DB @@ -377,7 +377,7 @@ func (b *memoryBackend) FollowURL(uid string, url string) (microsub.Feed, error) _ = b.ProcessContent(uid, fmt.Sprintf("%d", feedID), feed.URL, resp.Header.Get("Content-Type"), resp.Body) - _, _ = b.CreateFeed(url) + _, _ = b.hubBackend.CreateFeed(url) return feed, nil }