test(metadata): stop the aggregation worker before counting statements

This commit is contained in:
2026-11-23 14:58:44 +00:00
parent ba8bc392ec
commit a457e3d2e8
+1
View File
@@ -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.
func attachCounter(store *GORMStoreV2) *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 {
counted, c := dbcount.Attach(db)
counter = c