changeset 5546:76a3f60b243e HEAD

cache_secs fixes
author Timo Sirainen <tss@iki.fi>
date Wed, 11 Apr 2007 20:40:18 +0300
parents 125a422edfda
children c03655b70b57
files src/plugins/acl/acl-backend-vfile.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/acl/acl-backend-vfile.c	Wed Apr 11 15:08:50 2007 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c	Wed Apr 11 20:40:18 2007 +0300
@@ -16,10 +16,8 @@
 
 #define ACL_FILENAME "dovecot-acl"
 
-/* Time difference to allow between this system's time and file server's time */
-#define ACL_SYNC_SECS 1
-
 #define ACL_ESTALE_RETRY_COUNT NFS_ESTALE_RETRY_COUNT
+#define ACL_VFILE_DEFAULT_CACHE_SECS (60*5)
 
 struct acl_vfile_validity {
 	time_t last_check;
@@ -85,6 +83,7 @@
 	t_push();
 	tmp = t_strsplit(data, ":");
 	backend->global_dir = p_strdup_empty(_backend->pool, *tmp);
+	backend->cache_secs = ACL_VFILE_DEFAULT_CACHE_SECS;
 
 	while (*++tmp != NULL) {
 		if (strncmp(*tmp, "cache_secs=", 11) == 0)
@@ -416,8 +415,10 @@
 		   do it only after a couple of seconds so we don't
 		   keep re-reading it all the time within those
 		   seconds) */
-		if (st.st_mtime < validity->last_read_time - ACL_SYNC_SECS ||
-		    ioloop_time - validity->last_read_time <= ACL_SYNC_SECS)
+		unsigned int cache_secs = backend->cache_secs;
+
+		if (st.st_mtime < validity->last_read_time - cache_secs ||
+		    ioloop_time - validity->last_read_time <= cache_secs)
 			return 0;
 	}