/* Copyright (C) 2003-2004 Timo Sirainen */
#include "lib.h"
+#include "ioloop.h"
#include "buffer.h"
#include "file-lock.h"
#include "file-dotlock.h"
file->lock_type = F_UNLCK;
file->st_dev = st.st_dev;
file->st_ino = st.st_ino;
+ file->last_mtime = st.st_mtime;
ret = mail_transaction_log_file_read_hdr(file, &st);
if (ret == 0) {
file->st_dev = st.st_dev;
file->st_ino = st.st_ino;
+ file->last_mtime = st.st_mtime;
memset(&file->hdr, 0, sizeof(file->hdr));
ret = mail_transaction_log_file_read_hdr(file, &st);
}
if (log->head->hdr.file_seq == index->hdr->log_file_seq &&
- log->head->hdr.used_size > MAIL_TRANSACTION_LOG_ROTATE_SIZE) {
+ log->head->hdr.used_size > MAIL_TRANSACTION_LOG_ROTATE_SIZE &&
+ log->head->last_mtime <
+ ioloop_time - MAIL_TRANSACTION_LOG_ROTATE_MIN_TIME) {
/* everything synced in index, we can rotate. */
if (mail_transaction_log_rotate(log) < 0) {
if (!log->index->log_locked) {
#define MAIL_TRANSACTION_LOG_PREFIX ".log"
#define MAIL_TRANSACTION_LOG_ROTATE_SIZE (1024*128)
+#define MAIL_TRANSACTION_LOG_ROTATE_MIN_TIME (60*5)
struct mail_transaction_log_header {
uint32_t indexid;