Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analysis Fixes #1289

Merged
merged 9 commits into from
Jun 22, 2017
13 changes: 7 additions & 6 deletions src/analyzer/analyzerqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,22 @@ void AnalyzerQueue::run() {
}

void AnalyzerQueue::execThread() {
// The thread-local database connection for waveform anylsis must not
// be closed before returning from this function. Therefore the
// DbConnectionPooler is defined at the outher function scope,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here. Did you mean "other" or "outer"?

// independent of whether a database connection is opened or not.
mixxx::DbConnectionPooler dbConnectionPooler;
// m_pAnalysisDao remains null if no analyzer needs database access.
// Currently only waveform analyses makes use of it.
if (m_pAnalysisDao) {
// Only create/open a new database connection for when needed
// for storing waveform analyses
dbConnectionPooler = mixxx::DbConnectionPooler(m_pDbConnectionPool);
if (!dbConnectionPooler) {
kLogger.warning()
<< "Failed to open database connection for analyzer queue thread";
return;
}
// Use the newly created database connection for this thread
// Obtain and use the newly created database connection within this thread
m_pAnalysisDao->initialize(mixxx::DbConnectionPooled(m_pDbConnectionPool));
// The database connection is valid until dbConnectionPooler is destroyed
// when exiting the enclosing function scope. The pooler as the owner of
// the connection must not be destroyed now!
}

m_progressInfo.current_track.reset();
Expand Down