Fix to speed up Sieve processing, taking relatively a lot of time that
authorDave West <davew@uncensored.citadel.org>
Wed, 5 Sep 2007 18:26:59 +0000 (18:26 +0000)
committerDave West <davew@uncensored.citadel.org>
Wed, 5 Sep 2007 18:26:59 +0000 (18:26 +0000)
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

index cc6d8b17299fb1160cb603717286bc468f3d74d2..010e76b43de4a8936bcfeca943173f4fb1b6d684 100644 (file)
@@ -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);
+
 }