updates to maybe prevent dead lock and warning

This commit is contained in:
einhornimmond 2021-02-04 13:24:44 +01:00 committed by Ulf Gebhardt
parent 89f424f707
commit 191222872d
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
3 changed files with 7 additions and 5 deletions

View File

@ -197,6 +197,7 @@ namespace model {
auto outbound_transfer = mProtoTransfer.outbound();
return outbound_transfer.other_group();
}
return "<unkown>";
}
Poco::AutoPtr<Transaction> TransactionTransfer::createOutbound(const std::string& memo)

View File

@ -35,6 +35,7 @@ namespace model {
virtual ~ModelBase();
virtual const char* getTableName() const = 0;
//! called from within of some catch to give more information for debugging, don't lock mutex!
virtual std::string toString() = 0;
template<class T>
@ -122,9 +123,9 @@ namespace model {
auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
Poco::Data::Statement select(session);
size_t count = 0;
select
select
<< "SELECT count(id) from " << getTableName()
<< " where " << fieldName << " LIKE ? group by group_id"
<< " where " << fieldName << " LIKE ? group by " << fieldName
,Poco::Data::Keywords::into(count)
,Poco::Data::Keywords::useRef(fieldValue);

View File

@ -69,7 +69,9 @@ namespace model
ss << "id: " << mID << std::endl;
ss << "user_id: " << mUserId << std::endl;
ss << "created: " << Poco::DateTimeFormatter::format(mCreated, "%f.%m.%Y %H:%M:%S") << std::endl;
ss << "task type: " << typeToString((TaskType)mTaskTypeId);
ss << "task type: " << typeToString((TaskType)mTaskTypeId) << std::endl;
ss << "child pending task id: " << std::to_string(mChildPendingTaskId) << std::endl;
ss << "parent pending task id: " << std::to_string(mParentPendingTaskId) << std::endl;
return ss.str();
}
@ -138,7 +140,6 @@ namespace model
Poco::Data::Statement PendingTask::_loadIdFromDB(Poco::Data::Session session)
{
Poco::Data::Statement select(session);
Poco::ScopedLock<Poco::Mutex> _lock(mWorkMutex);
select << "SELECT id FROM " << getTableName()
<< " WHERE user_id = ? "
@ -155,7 +156,6 @@ namespace model
Poco::Data::Statement PendingTask::_insertIntoDB(Poco::Data::Session session)
{
Poco::Data::Statement insert(session);
Poco::ScopedLock<Poco::Mutex> _lock(mWorkMutex);
insert << "INSERT INTO " << getTableName()
<< " (user_id, hedera_id, request, created, task_type_id, child_pending_task_id, parent_pending_task_id) VALUES(?,?,?,?,?,?,?)"