Skip to content

Commit

Permalink
Fixed prepared statement leak
Browse files Browse the repository at this point in the history
  • Loading branch information
dedmen committed May 31, 2019
1 parent fcb864d commit 6f9c1a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ GameDataDBAsyncResult* Connection::pushAsyncQuery(game_state& gs, mariadb::conne
throwQueryError(gs, con, 1337, static_cast<r_string>(x.what()), queryString);
return false;
}
});
}, true);
return gd_res;
}

Expand Down
6 changes: 4 additions & 2 deletions src/threading.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "threading.h"
#include "ittnotify.h"
#include "../ittnotify/ittnotify.h"
using namespace std::chrono_literals;

#include <iomanip> // put_time
Expand Down Expand Up @@ -80,9 +81,10 @@ void Worker::run() {
__itt_task_begin(domain, __itt_null, __itt_null, worker_processTaskTask);
uint64_t tasksLeft = tasks.size();
__itt_counter_set_value(counter, &tasksLeft);
if (!tasks.empty()) {
if (tasksLeft) {
std::shared_ptr<Task> task = tasks.front();
tasks.pop();
tasksLeft--;
lastJob = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
__itt_sync_releasing(&taskLock);
l.unlock();
Expand All @@ -91,7 +93,7 @@ void Worker::run() {
task->prom.set_value(task->job(workerConnection));
__itt_task_end(domain);
if (task->isInWorkList || rememberUpdateWorklist) {
if (tasksLeft % 64 == 0) {
if (tasksLeft % 64 == 0) { //Don't trust the compiler telling you nonsense
Threading::get().updateAsyncWorkLists();
rememberUpdateWorklist = false;
} else
Expand Down

0 comments on commit 6f9c1a0

Please sign in to comment.