spetz commented on code in PR #2452:
URL: https://github.com/apache/iggy/pull/2452#discussion_r2617443451
##########
core/server/src/log/logger.rs:
##########
@@ -417,6 +457,160 @@ impl Logging {
)
}
}
+
+ fn calculate_max_files(max_total_size_bytes: u64, max_file_size_bytes:
u64) -> usize {
+ if max_file_size_bytes == 0 {
+ return 10;
+ }
+
+ let max_files = max_total_size_bytes / max_file_size_bytes;
+ max_files.clamp(1, 1000) as usize
+ }
+
+ // Use a mutex lock to ensure log rotation operations do not produce race
conditions.
+ fn _install_log_rotation_handler(&self, config: &LoggingConfig, logs_path:
Option<&PathBuf>) {
+ if let Some(logs_path) = logs_path {
+ let path = logs_path.to_path_buf();
+ let max_size = config.max_size.as_bytes_u64();
+ let retention = config.retention.get_duration();
+ let rotation_mutex = Arc::new(Mutex::new(()));
+ let rotation_mutex_clone = Arc::clone(&rotation_mutex);
+ std::thread::spawn(move || {
+ loop {
+ std::thread::sleep(Duration::from_secs(3600));
Review Comment:
What was the reason behind 1h? IMHO this `duration` could be added to const
on top.
--
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]