mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 07:52:24 -05:00
[feature/performance] Store account stats in separate table (#2831)
* [feature/performance] Store account stats in separate table, get stats from remote * test account stats * add some missing increment / decrement calls * change stats function signatures * rejig logging a bit * use lock when updating stats
This commit is contained in:
parent
f79d50b9b2
commit
3cceed11b2
43 changed files with 1285 additions and 450 deletions
|
|
@ -105,6 +105,15 @@ func (iter *regularCollectionIterator) PrevItem() TypeOrIRI {
|
|||
return cur
|
||||
}
|
||||
|
||||
func (iter *regularCollectionIterator) TotalItems() int {
|
||||
totalItems := iter.GetActivityStreamsTotalItems()
|
||||
if totalItems == nil || !totalItems.IsXMLSchemaNonNegativeInteger() {
|
||||
return -1
|
||||
}
|
||||
|
||||
return totalItems.Get()
|
||||
}
|
||||
|
||||
func (iter *regularCollectionIterator) initItems() bool {
|
||||
if iter.once {
|
||||
return (iter.items != nil)
|
||||
|
|
@ -147,6 +156,15 @@ func (iter *orderedCollectionIterator) PrevItem() TypeOrIRI {
|
|||
return cur
|
||||
}
|
||||
|
||||
func (iter *orderedCollectionIterator) TotalItems() int {
|
||||
totalItems := iter.GetActivityStreamsTotalItems()
|
||||
if totalItems == nil || !totalItems.IsXMLSchemaNonNegativeInteger() {
|
||||
return -1
|
||||
}
|
||||
|
||||
return totalItems.Get()
|
||||
}
|
||||
|
||||
func (iter *orderedCollectionIterator) initItems() bool {
|
||||
if iter.once {
|
||||
return (iter.items != nil)
|
||||
|
|
@ -203,6 +221,15 @@ func (iter *regularCollectionPageIterator) PrevItem() TypeOrIRI {
|
|||
return cur
|
||||
}
|
||||
|
||||
func (iter *regularCollectionPageIterator) TotalItems() int {
|
||||
totalItems := iter.GetActivityStreamsTotalItems()
|
||||
if totalItems == nil || !totalItems.IsXMLSchemaNonNegativeInteger() {
|
||||
return -1
|
||||
}
|
||||
|
||||
return totalItems.Get()
|
||||
}
|
||||
|
||||
func (iter *regularCollectionPageIterator) initItems() bool {
|
||||
if iter.once {
|
||||
return (iter.items != nil)
|
||||
|
|
@ -259,6 +286,15 @@ func (iter *orderedCollectionPageIterator) PrevItem() TypeOrIRI {
|
|||
return cur
|
||||
}
|
||||
|
||||
func (iter *orderedCollectionPageIterator) TotalItems() int {
|
||||
totalItems := iter.GetActivityStreamsTotalItems()
|
||||
if totalItems == nil || !totalItems.IsXMLSchemaNonNegativeInteger() {
|
||||
return -1
|
||||
}
|
||||
|
||||
return totalItems.Get()
|
||||
}
|
||||
|
||||
func (iter *orderedCollectionPageIterator) initItems() bool {
|
||||
if iter.once {
|
||||
return (iter.items != nil)
|
||||
|
|
|
|||
|
|
@ -307,6 +307,12 @@ type CollectionIterator interface {
|
|||
|
||||
NextItem() TypeOrIRI
|
||||
PrevItem() TypeOrIRI
|
||||
|
||||
// TotalItems returns the total items
|
||||
// present in the collection, derived
|
||||
// from the totalItems property, or -1
|
||||
// if totalItems not present / readable.
|
||||
TotalItems() int
|
||||
}
|
||||
|
||||
// CollectionPageIterator represents the minimum interface for interacting with a wrapped
|
||||
|
|
@ -319,6 +325,12 @@ type CollectionPageIterator interface {
|
|||
|
||||
NextItem() TypeOrIRI
|
||||
PrevItem() TypeOrIRI
|
||||
|
||||
// TotalItems returns the total items
|
||||
// present in the collection, derived
|
||||
// from the totalItems property, or -1
|
||||
// if totalItems not present / readable.
|
||||
TotalItems() int
|
||||
}
|
||||
|
||||
// Flaggable represents the minimum interface for an activitystreams 'Flag' activity.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue