mirror of
https://github.com/mjl-/mox.git
synced 2024-12-27 08:53:48 +03:00
fix flaky test: close account before marking thread-upgrade as finished
store/threads_test.go opens an account, starts the threading upgrade, waits for it to finish, runs some tests, and closes the account at the end, verifying all references are gone. the "thread upgrade" goroutine has its own account reference. it closes its account after having signaled completion of the upgrade. in between that time, all checks from the tests could run, its account closed and its no-more-account-references check would fail. the fix is hopefully to mark the thread upgrade process finished after closing the account. hard to verify, but this only happens very rarely.
This commit is contained in:
parent
b3a693ee31
commit
ff6cca1bf9
1 changed files with 3 additions and 3 deletions
|
@ -1016,6 +1016,9 @@ func OpenAccountDB(log mlog.Log, accountDir, accountName string) (a *Account, re
|
||||||
defer func() {
|
defer func() {
|
||||||
err := closeAccount(acc)
|
err := closeAccount(acc)
|
||||||
log.Check(err, "closing use of account after upgrading account storage for threads", slog.String("account", a.Name))
|
log.Check(err, "closing use of account after upgrading account storage for threads", slog.String("account", a.Name))
|
||||||
|
|
||||||
|
// Mark that upgrade has finished, possibly error is indicated in threadsErr.
|
||||||
|
close(acc.threadsCompleted)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -1026,9 +1029,6 @@ func OpenAccountDB(log mlog.Log, accountDir, accountName string) (a *Account, re
|
||||||
metrics.PanicInc(metrics.Upgradethreads)
|
metrics.PanicInc(metrics.Upgradethreads)
|
||||||
acc.threadsErr = fmt.Errorf("panic during upgradeThreads: %v", x)
|
acc.threadsErr = fmt.Errorf("panic during upgradeThreads: %v", x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark that upgrade has finished, possibly error is indicated in threadsErr.
|
|
||||||
close(acc.threadsCompleted)
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err := upgradeThreads(mox.Shutdown, log, acc, &up)
|
err := upgradeThreads(mox.Shutdown, log, acc, &up)
|
||||||
|
|
Loading…
Reference in a new issue