mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-27 06:46:01 +00:00
test(metadata): stop the aggregation worker before counting statements
This commit is contained in:
@@ -196,6 +196,7 @@ func checkTrendWindow(t *testing.T, store *GORMStoreV2) {
|
|||||||
// attachCounter counts the statements of the store and of its worker, which holds its own handle.
|
// attachCounter counts the statements of the store and of its worker, which holds its own handle.
|
||||||
func attachCounter(store *GORMStoreV2) *dbcount.Counter {
|
func attachCounter(store *GORMStoreV2) *dbcount.Counter {
|
||||||
var counter *dbcount.Counter
|
var counter *dbcount.Counter
|
||||||
|
store.aggregationWorker.Stop() // its handle is swapped below; a running loop would race
|
||||||
store.WrapDB(func(db *gorm.DB) *gorm.DB {
|
store.WrapDB(func(db *gorm.DB) *gorm.DB {
|
||||||
counted, c := dbcount.Attach(db)
|
counted, c := dbcount.Attach(db)
|
||||||
counter = c
|
counter = c
|
||||||
|
|||||||
Reference in New Issue
Block a user