From 7c7de044bb08aa6b5c9f32c000c3b97a3c55ca31 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 18 Nov 2009 19:09:26 -0500 Subject: Better behavior on cleanup With the previous code in domains with many users and enumeration enable we would eventually end up making thousands of individual searches for entries in the clean-up process. Change the code to do a full enumeration before a cleanup so we do one single big search to update all entries and only then search for entries to purge. This also fixes the fact that the cleanup task was running at every enumeration instead of running every "ldap_purge_cache_timeout" seconds. --- server/providers/ldap/ldap_id_cleanup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/providers/ldap/ldap_id_cleanup.c') diff --git a/server/providers/ldap/ldap_id_cleanup.c b/server/providers/ldap/ldap_id_cleanup.c index 7267b3540..60d3b28ac 100644 --- a/server/providers/ldap/ldap_id_cleanup.c +++ b/server/providers/ldap/ldap_id_cleanup.c @@ -60,8 +60,6 @@ static void ldap_id_cleanup_timer(struct tevent_context *ev, return; } - ctx->last_run = tv; - req = ldap_id_cleanup_send(ctx, ev, ctx); if (!req) { DEBUG(1, ("Failed to schedule cleanup, retrying later!\n")); @@ -113,7 +111,7 @@ static void ldap_id_cleanup_reschedule(struct tevent_req *req) /* On error schedule starting from now, not the last run */ tv = tevent_timeval_current(); } else { - tv = ctx->last_run; + tv = ctx->last_purge; } talloc_zfree(req); @@ -177,6 +175,8 @@ struct tevent_req *ldap_id_cleanup_send(TALLOC_CTX *memctx, } tevent_req_set_callback(subreq, ldap_id_cleanup_users_done, req); + ctx->last_purge = tevent_timeval_current(); + return req; } -- cgit