From 56232966ec7d9423cfd503e39a6798ceb8fa59a8 Mon Sep 17 00:00:00 2001 From: Ivan Chvets Date: Fri, 29 Nov 2024 13:09:34 -0500 Subject: [PATCH] fix: modified code for file upload transactions https://telecominfraproject.atlassian.net/browse/OLS-380 Summary of changes: - Modified code to have two distinct transaction in storage file upload. Signed-off-by: Ivan Chvets --- src/storage/storage_command.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/storage/storage_command.cpp b/src/storage/storage_command.cpp index 3f8d497c..90b16456 100644 --- a/src/storage/storage_command.cpp +++ b/src/storage/storage_command.cpp @@ -644,8 +644,6 @@ namespace OpenWifi { uint64_t Size = FileContent.str().size(); Poco::Data::Session Sess = Pool_->get(); - Sess.begin(); - Poco::Data::Statement Statement(Sess); if (Size < FileUploader()->MaxSize()) { @@ -668,9 +666,10 @@ namespace OpenWifi { } else { poco_warning(Logger(), fmt::format("File {} is too large.", UUID)); } - Sess.commit(); // update CommandList here to ensure that file us uploaded + Sess.begin(); + Poco::Data::Statement Statement(Sess); std::string StatementStr; StatementStr = "UPDATE CommandList SET WaitingForFile=?, AttachDate=?, AttachSize=? WHERE UUID=?"; @@ -825,4 +824,4 @@ namespace OpenWifi { return false; } -} // namespace OpenWifi \ No newline at end of file +} // namespace OpenWifi