dovecot-2.2-pigeonhole: lib-sieve: Flush duplicate database duri...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Thu Nov 20 00:04:08 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/57b48c0580cd
changeset: 1971:57b48c0580cd
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Thu Nov 20 01:04:00 2014 +0100
description:
lib-sieve: Flush duplicate database during start phase of result execution rather than commit phase.
This will release the duplicate database lock earlier, even before a mail storage transation is started.

diffstat:

 src/lib-sieve/sieve-result.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r d0ca187be049 -r 57b48c0580cd src/lib-sieve/sieve-result.c
--- a/src/lib-sieve/sieve-result.c	Thu Nov 20 00:53:41 2014 +0100
+++ b/src/lib-sieve/sieve-result.c	Thu Nov 20 01:04:00 2014 +0100
@@ -1106,8 +1106,10 @@
 (struct sieve_result *result, struct sieve_result_action *first,
 	struct sieve_result_action **last_r)
 {
+	const struct sieve_script_env *senv = result->action_env.scriptenv;
 	struct sieve_result_action *rac = first;
 	int status = SIEVE_EXEC_OK;
+	bool dup_flushed = FALSE;
 
 	while ( status == SIEVE_EXEC_OK && rac != NULL ) {
 		struct sieve_action *act = &rac->action;
@@ -1118,6 +1120,12 @@
 			continue;
 		}
 
+		if ((act->def->flags & SIEVE_ACTFLAG_MAIL_STORAGE) != 0 &&
+			!dup_flushed) {
+			sieve_action_duplicate_flush(senv);
+			dup_flushed = TRUE;
+		}
+
 		if ( act->def->start != NULL ) {
 			status = act->def->start
 				(act, &result->action_env, &rac->tr_context);
@@ -1283,10 +1291,8 @@
 	struct sieve_result_action *last,
 	bool *implicit_keep, bool *keep)
 {
-	const struct sieve_script_env *senv = result->action_env.scriptenv;
 	struct sieve_result_action *rac;
 	int commit_status = status;
-	bool dup_flushed = FALSE;
 
 	/* First commit/rollback all storage actions */
 	rac = first;
@@ -1299,11 +1305,6 @@
 			continue;
 		}
 
-		if (!dup_flushed) {
-			sieve_action_duplicate_flush(senv);
-			dup_flushed = TRUE;
-		}
-
 		status = sieve_result_action_commit_or_rollback
 			(result, rac, status, implicit_keep, keep, &commit_status);
 


More information about the dovecot-cvs mailing list