diff --git a/src/cpp/HTTPInterface/ElopageWebhook.cpp b/src/cpp/HTTPInterface/ElopageWebhook.cpp index 8cbffe62c..36ca06b13 100644 --- a/src/cpp/HTTPInterface/ElopageWebhook.cpp +++ b/src/cpp/HTTPInterface/ElopageWebhook.cpp @@ -274,8 +274,8 @@ int HandleElopageRequestTask::run() // if user exist we can stop now if (getUserIdFromDB()) { - addError(param_error_order_id); - sendErrorsAsEmail(); + //addError(param_error_order_id); + //sendErrorsAsEmail(); return -2; } diff --git a/src/cpp/lib/MultithreadContainer.cpp b/src/cpp/lib/MultithreadContainer.cpp index 8e078f8c2..19ac4677b 100644 --- a/src/cpp/lib/MultithreadContainer.cpp +++ b/src/cpp/lib/MultithreadContainer.cpp @@ -6,15 +6,23 @@ namespace UniLib { void MultithreadContainer::lock(const char* stackDetails/* = nullptr*/) { + const static char* functionName = "MultithreadContainer::lock"; try { mWorkMutex.lock(500); + if (stackDetails) { + mLastSucceededLock = stackDetails; + } } catch (Poco::TimeoutException& ex) { ErrorList errors; - if (stackDetails) { - errors.addError(new Error("MultithreadContainer::lock", stackDetails)); + errors.addError(new ParamError(functionName, "lock timeout", ex.displayText())); + if (mLastSucceededLock != "") { + errors.addError(new ParamError(functionName, "last succeed lock by ", mLastSucceededLock.data())); } - errors.addError(new ParamError("MultithreadContainer::lock", "lock timeout", ex.displayText())); + if (stackDetails) { + errors.addError(new Error(functionName, stackDetails)); + } + errors.sendErrorsAsEmail(); } } diff --git a/src/cpp/lib/MultithreadContainer.h b/src/cpp/lib/MultithreadContainer.h index 272f81e61..78ac0ad03 100644 --- a/src/cpp/lib/MultithreadContainer.h +++ b/src/cpp/lib/MultithreadContainer.h @@ -44,10 +44,11 @@ namespace UniLib { void lock(const char* stackDetails = nullptr); - inline void unlock() {mWorkMutex.unlock();} + inline void unlock() { mLastSucceededLock = ""; mWorkMutex.unlock(); } protected: private: Poco::Mutex mWorkMutex; + std::string mLastSucceededLock; }; } } diff --git a/src/cpp/model/TransactionTransfer.cpp b/src/cpp/model/TransactionTransfer.cpp index 08b1011a1..7ace47627 100644 --- a/src/cpp/model/TransactionTransfer.cpp +++ b/src/cpp/model/TransactionTransfer.cpp @@ -1,6 +1,6 @@ #include "TransactionTransfer.h" - +const std::string TransactionTransfer::mInvalidIndexMessage("invalid index"); TransactionTransfer::KontoTableEntry::KontoTableEntry(User* user, google::protobuf::int64 amount, bool negativeAmount/* = false*/) { @@ -133,10 +133,11 @@ int TransactionTransfer::prepare() const std::string& TransactionTransfer::getKontoNameCell(int index) { + lock(); if (index >= mKontoTable.size()) { unlock(); - return "invalid index"; + return mInvalidIndexMessage; } unlock(); @@ -147,7 +148,7 @@ const std::string& TransactionTransfer::getAmountCell(int index) lock(); if (index >= mKontoTable.size()) { unlock(); - return "invalid index"; + return mInvalidIndexMessage; } unlock(); diff --git a/src/cpp/model/TransactionTransfer.h b/src/cpp/model/TransactionTransfer.h index 987076b27..01b8e2984 100644 --- a/src/cpp/model/TransactionTransfer.h +++ b/src/cpp/model/TransactionTransfer.h @@ -27,6 +27,7 @@ public: const std::string& getAmountCell(int index); protected: + const static std::string mInvalidIndexMessage; struct KontoTableEntry { public: KontoTableEntry(User* user, google::protobuf::int64 amount, bool negativeAmount = false);