From cc1c8538079c8daa9f103d8a48eb63fced2ec2fc Mon Sep 17 00:00:00 2001 From: Dave West Date: Wed, 5 Sep 2007 18:26:59 +0000 Subject: [PATCH] Fix to speed up Sieve processing, taking relatively a lot of time that would cause heavy load if there are lots of users with lots of scripts. rewrite_ctdl_sieve_config() was rewriting the sieve config every time regardless of the yes_write_to_disk flag thus calling quickie_message() which takes a bit of time (an extra 0.3mS). --- citadel/modules/sieve/serv_sieve.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/citadel/modules/sieve/serv_sieve.c b/citadel/modules/sieve/serv_sieve.c index cc6d8b172..010e76b43 100644 --- a/citadel/modules/sieve/serv_sieve.c +++ b/citadel/modules/sieve/serv_sieve.c @@ -769,19 +769,23 @@ void rewrite_ctdl_sieve_config(struct sdm_userdata *u, int yes_write_to_disk) { sprintf(&text[strlen(text)], CTDLSIEVECONFIGSEPARATOR); } - /* Save the config */ - quickie_message("Citadel", NULL, NULL, u->config_roomname, - text, - 4, - "Sieve configuration" - ); - - free (text); - /* And delete the old one */ - if (u->config_msgnum > 0) { - CtdlDeleteMessages(u->config_roomname, &u->config_msgnum, 1, ""); + if (yes_write_to_disk) + { + /* Save the config */ + quickie_message("Citadel", NULL, NULL, u->config_roomname, + text, + 4, + "Sieve configuration" + ); + + /* And delete the old one */ + if (u->config_msgnum > 0) { + CtdlDeleteMessages(u->config_roomname, &u->config_msgnum, 1, ""); + } } + free (text); + } -- 2.30.2