Problem: memorybackend is a hubbackend
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Solution: memorybackend has a hubbackend
This commit is contained in:
parent
531f6b31d9
commit
892a9cec72
|
@ -52,20 +52,13 @@ func NewApp(options AppOptions) (*App, error) {
|
||||||
app.backend.Me = "https://p83.nl/"
|
app.backend.Me = "https://p83.nl/"
|
||||||
|
|
||||||
app.backend.AuthEnabled = options.AuthEnabled
|
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{
|
app.hubBackend = &hubIncomingBackend{
|
||||||
backend: app.backend,
|
|
||||||
baseURL: options.BaseURL,
|
baseURL: options.BaseURL,
|
||||||
pool: options.pool,
|
pool: options.pool,
|
||||||
database: options.database,
|
database: options.database,
|
||||||
}
|
}
|
||||||
app.backend.hubIncomingBackend = *app.hubBackend
|
app.backend.hubBackend = app.hubBackend
|
||||||
|
|
||||||
http.Handle("/micropub", µpubHandler{
|
http.Handle("/micropub", µpubHandler{
|
||||||
Backend: app.backend,
|
Backend: app.backend,
|
||||||
|
|
|
@ -29,7 +29,6 @@ type HubBackend interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type hubIncomingBackend struct {
|
type hubIncomingBackend struct {
|
||||||
backend *memoryBackend
|
|
||||||
baseURL string
|
baseURL string
|
||||||
pool *redis.Pool
|
pool *redis.Pool
|
||||||
database *sql.DB
|
database *sql.DB
|
||||||
|
|
|
@ -40,8 +40,6 @@ func init() {
|
||||||
const DefaultPrio = 9999999
|
const DefaultPrio = 9999999
|
||||||
|
|
||||||
type memoryBackend struct {
|
type memoryBackend struct {
|
||||||
hubIncomingBackend
|
|
||||||
|
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
Channels map[string]microsub.Channel
|
Channels map[string]microsub.Channel
|
||||||
Feeds map[string][]microsub.Feed
|
Feeds map[string][]microsub.Feed
|
||||||
|
@ -57,6 +55,8 @@ type memoryBackend struct {
|
||||||
|
|
||||||
broker *sse.Broker
|
broker *sse.Broker
|
||||||
|
|
||||||
|
hubBackend HubBackend
|
||||||
|
|
||||||
pool *redis.Pool
|
pool *redis.Pool
|
||||||
|
|
||||||
database *sql.DB
|
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.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
|
return feed, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user