Merge pull request #932 from jaten-molecula/pr919

api usage should ignore tx stores. fixes #919
This commit is contained in:
tgruben 2020-10-06 09:45:43 -05:00 committed by GitHub
commit 8dbfaf5045
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

3
api.go
View file

@ -812,6 +812,9 @@ func (api *API) Usage() (map[string]int64, int64, error) {
if !file.IsDir() {
continue
}
if api.holder.Txf().IsTxDatabasePath(file.Name()) {
continue
}
fullName := path.Join(dirName, file.Name())
indexSizes[file.Name()], err = diskUsage(fullName)
if err != nil {

View file

@ -95,9 +95,9 @@ func Test_TxFactory_Qcx_query_context(t *testing.T) {
// allow all goro to finish before Closing the lmdb.env, otherwise
// we will crash as the goroutines making Tx will try to use the env
// after it is closed. It can take quite a while.
// one writer might be blocking the other... so ask for only N-1 at first.
barrier.BlockUntil(N - 1)
//barrier.BlockUntil(N)
// one writer might be blocking the other... so ask for only N-2 at first
// to avoid deadlock.
barrier.BlockUntil(N - 2)
barrier.UnblockReaders()
time.Sleep(1 * time.Second)
}