Copilot commented on code in PR #1926:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1926#discussion_r2030789396


##########
extension-utils/src/utils/ListingStateManager.cpp:
##########
@@ -44,17 +44,19 @@ uint64_t 
ListingState::getListedKeyTimeStampInMilliseconds() const {
   return listed_key_timestamp.time_since_epoch() / 
std::chrono::milliseconds(1);
 }
 
-uint64_t ListingStateManager::getLatestListedKeyTimestampInMilliseconds(const 
std::unordered_map<std::string, std::string> &state) {
+uint64_t ListingStateManager::getLatestListedKeyTimestampInMilliseconds(const 
std::unordered_map<std::string, std::string> &state) const {
   std::string stored_listed_key_timestamp_str;
   auto it = state.find(LATEST_LISTED_OBJECT_TIMESTAMP);
   if (it != state.end()) {
     stored_listed_key_timestamp_str = it->second;
   }
 
-  int64_t stored_listed_key_timestamp = 0;
-  core::Property::StringToInt(stored_listed_key_timestamp_str, 
stored_listed_key_timestamp);
+  if (auto stored_listed_key_timestamp = 
parsing::parseIntegral<int64_t>(stored_listed_key_timestamp_str)) {
+    return *stored_listed_key_timestamp;
+  }
 
-  return stored_listed_key_timestamp;
+  logger_->log_error("Invalid listed key timestamp, returning 0");

Review Comment:
   [nitpick] Consider including the invalid timestamp value in the log message 
to facilitate easier debugging of state parsing issues.
   ```suggestion
     logger_->log_error("Invalid listed key timestamp '{}', returning 0", 
stored_listed_key_timestamp_str);
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to