aboutsummaryrefslogtreecommitdiffstats
path: root/src/statfile.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-09-16 19:18:23 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-09-16 19:18:23 +0400
commit18e0c770b951c5d8a1269b3829b73a416fc261fe (patch)
tree31ab1e9eee734251a883b0e9409f7983fedd940d /src/statfile.h
parente2d78f30503d3f02eec9925f2e222b7b1493f1ad (diff)
downloadrspamd-18e0c770b951c5d8a1269b3829b73a416fc261fe.tar.gz
rspamd-18e0c770b951c5d8a1269b3829b73a416fc261fe.zip
* Fix shared usage of statfiles
* Add invalidation of statfiles in case of learning, so now statfiles are invalidated in about a minute after learning * This should fix shared usage of statfile pool by several processes
Diffstat (limited to 'src/statfile.h')
-rw-r--r--src/statfile.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/statfile.h b/src/statfile.h
index 95f800ce6..dfdd16dbe 100644
--- a/src/statfile.h
+++ b/src/statfile.h
@@ -18,6 +18,9 @@
#define STATFILE_SECTION_URLS 3
#define STATFILE_SECTION_REGEXP 4
+#define DEFAULT_STATFILE_INVALIDATE_TIME 30
+#define DEFAULT_STATFILE_INVALIDATE_JITTER 30
+
/**
* Common statfile header
*/
@@ -89,6 +92,8 @@ typedef struct statfile_pool_s {
size_t occupied; /**< current size */
memory_pool_t *pool; /**< memory pool object */
memory_pool_mutex_t *lock; /**< mutex */
+ struct event *invalidate_event; /**< event for pool invalidation */
+ struct timeval invalidate_tv;
} statfile_pool_t;
/**
@@ -242,4 +247,10 @@ uint64_t statfile_get_used_blocks (stat_file_t *file);
*/
uint64_t statfile_get_total_blocks (stat_file_t *file);
+
+/**
+ * Plan statfile pool invalidation
+ */
+void statfile_pool_plan_invalidate (statfile_pool_t *pool, time_t seconds, time_t jitter);
+
#endif