dovecot-2.0: doveadm expire: Added more error and debug messages.

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 22 11:04:57 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/9862e8388a1c
changeset: 12614:9862e8388a1c
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 22 11:04:55 2011 +0200
description:
doveadm expire: Added more error and debug messages.

diffstat:

 src/plugins/expire/doveadm-expire.c |  23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diffs (63 lines):

diff -r dc4e0320c087 -r 9862e8388a1c src/plugins/expire/doveadm-expire.c
--- a/src/plugins/expire/doveadm-expire.c	Tue Feb 22 10:43:28 2011 +0200
+++ b/src/plugins/expire/doveadm-expire.c	Tue Feb 22 11:04:55 2011 +0200
@@ -64,7 +64,8 @@
 
 static bool
 doveadm_expire_mail_want(struct doveadm_mail_cmd_context *ctx,
-			 const char *key, time_t stamp, const char **username_r)
+			 const char *key, time_t oldest_savedate,
+			 const char **username_r)
 {
 	struct doveadm_expire_mail_cmd_context *ectx =
 		DOVEADM_EXPIRE_MAIL_CMD_CONTEXT(ctx);
@@ -76,6 +77,7 @@
 	mailbox = strchr(username, '/');
 	if (mailbox == NULL) {
 		/* invalid record, ignore */
+		i_error("expire: Invalid key: %s", key);
 		return FALSE;
 	}
 	username = t_strdup_until(username, mailbox++);
@@ -85,7 +87,8 @@
 		return FALSE;
 	}
 
-	if (!doveadm_expire_mail_match_mailbox(ectx, mailbox, stamp)) {
+	if (!doveadm_expire_mail_match_mailbox(ectx, mailbox,
+					       oldest_savedate)) {
 		/* this mailbox doesn't have any matching messages */
 		return FALSE;
 	}
@@ -103,19 +106,27 @@
 	struct doveadm_expire_mail_cmd_context *ectx =
 		DOVEADM_EXPIRE_MAIL_CMD_CONTEXT(ctx);
 	const char *key, *value;
-	unsigned long stamp;
+	unsigned long oldest_savedate;
 	bool ret;
 
 	while (dict_iterate(ectx->iter, &key, &value)) {
-		if (str_to_ulong(value, &stamp) < 0) {
+		if (str_to_ulong(value, &oldest_savedate) < 0) {
 			/* invalid record */
+			i_error("expire: Invalid timestamp: %s", value);
 			continue;
 		}
-		if ((time_t)stamp > ectx->oldest_before_time)
+		if ((time_t)oldest_savedate > ectx->oldest_before_time) {
+			if (doveadm_debug) {
+				i_debug("expire: Stopping iteration on key %s "
+					"(%lu > %ld)", key, oldest_savedate,
+					(long)ectx->oldest_before_time);
+			}
 			break;
+		}
 
 		T_BEGIN {
-			ret = doveadm_expire_mail_want(ctx, key, stamp,
+			ret = doveadm_expire_mail_want(ctx, key,
+						       oldest_savedate,
 						       username_r);
 		} T_END;
 		if (ret)


More information about the dovecot-cvs mailing list