Skip to content

Commit

Permalink
fix: avoid too many concurrent gdk calls
Browse files Browse the repository at this point in the history
  • Loading branch information
borgbyte committed Mar 17, 2022
1 parent f6bd79c commit d27f92a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/handlers/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ static QJsonObject getErrorDetails()

void Handler::exec()
{
static QThreadPool pool;
pool.setMaxThreadCount(2);

Q_ASSERT(!m_already_exec);
m_already_exec = true;

Q_ASSERT(!m_auth_handler);
setFuture(QtConcurrent::run([this] {
setFuture(QtConcurrent::run(&pool, [this] {
call(m_session->m_session, &m_auth_handler);
m_error_details = getErrorDetails();
if (!m_error_details.isEmpty()) {
Expand Down

0 comments on commit d27f92a

Please sign in to comment.