1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Bug2595: Don't make spurious disk-full errors while recording...

... The error that the checkpoint thread got was only SQLITE_BUSY, while the
main thread was simultaneously doing reads only for redrawing the screen.

Do some retrials in case of SQLITE_BUSY.
This commit is contained in:
Paul Licameli 2020-11-23 20:05:53 -05:00
parent 045bedfe04
commit e00f8da5d5

View File

@ -325,9 +325,18 @@ void DBConnection::CheckpointThread()
// And kick off the checkpoint. This may not checkpoint ALL frames
// in the WAL. They'll be gotten the next time around.
auto rc = giveUp ? SQLITE_OK :
sqlite3_wal_checkpoint_v2(
db, nullptr, SQLITE_CHECKPOINT_PASSIVE, nullptr, nullptr);
int rc;
using namespace std::chrono;
do {
rc = giveUp ? SQLITE_OK :
sqlite3_wal_checkpoint_v2(
db, nullptr, SQLITE_CHECKPOINT_PASSIVE, nullptr, nullptr);
}
// Contentions for an exclusive lock on the databse are possible,
// even while the main thread is merely drawing the tracks, which
// may perform reads
while (rc == SQLITE_BUSY && (std::this_thread::sleep_for(1ms), true));
// Reset
mCheckpointActive = false;