arpadboda commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb 
operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719#discussion_r372350686
 
 

 ##########
 File path: extensions/rocksdb-repos/FlowFileRepository.cpp
 ##########
 @@ -158,7 +166,21 @@ void FlowFileRepository::prune_stored_flowfiles() {
   }
 
   delete it;
+}
 
+bool FlowFileRepository::ExecuteWithRetry(std::function<rocksdb::Status()> 
operation) {
+  int waitTime = FLOWFILE_REPOSITORY_RETRY_INTERVAL;
+  for (int i=0; i<3; ++i) {
+    auto status = operation();
+    if (status.ok()) {
+      logger_->log_trace("Rocksdb operation executed successfully");
+      return true;
+    }
+    logger_->log_error("Rocksdb operation failed: %s", status.ToString());
+    std::this_thread::sleep_for(std::chrono::milliseconds(waitTime));
+    waitTime += FLOWFILE_REPOSITORY_RETRY_INTERVAL;
 
 Review comment:
   Agreed, I'm open for suggestion :) 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to