diff options
Diffstat (limited to 'resources/outbox.go')
-rw-r--r-- | resources/outbox.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/resources/outbox.go b/resources/outbox.go index 4ac4c6c..ed87dd8 100644 --- a/resources/outbox.go +++ b/resources/outbox.go @@ -32,7 +32,7 @@ func RenderOutboxPage(name, domain string, db *badger.DB) (map[string]interface{ itemsProp := streams.NewActivityStreamsOrderedItemsProperty() - db.View(func(txn *badger.Txn) error { + err = db.View(func(txn *badger.Txn) error { it := txn.NewIterator(badger.DefaultIteratorOptions) defer it.Close() prefix := []byte("outbox:sample") // TODO @@ -58,6 +58,9 @@ func RenderOutboxPage(name, domain string, db *badger.DB) (map[string]interface{ } return nil }) + if err != nil { + return nil, err + } oc.SetActivityStreamsOrderedItems(itemsProp) return streams.Serialize(oc) @@ -82,15 +85,18 @@ func RenderOutbox(name, domain string, db *badger.DB) (map[string]interface{}, e oc.SetJSONLDId(idProp) var i int - db.View(func(txn *badger.Txn) error { + err = db.View(func(txn *badger.Txn) error { it := txn.NewIterator(badger.DefaultIteratorOptions) defer it.Close() - prefix := []byte("outbox:sample") + prefix := []byte("outbox:sample") // TODO for it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() { i++ } return nil }) + if err != nil { + return nil, err + } itemsProp := streams.NewActivityStreamsTotalItemsProperty() itemsProp.Set(i) |