summaryrefslogtreecommitdiffstats
path: root/server/providers/ldap/ldap_id_cleanup.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-11-18 19:09:26 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-11-20 11:18:50 -0500
commit7c7de044bb08aa6b5c9f32c000c3b97a3c55ca31 (patch)
tree9131e9a87fda825a2a4502e026f3eb5153af592a /server/providers/ldap/ldap_id_cleanup.c
parentc35c2e840a5f97ebe4c1dd5a5b82745c34217320 (diff)
downloadsssd-7c7de044bb08aa6b5c9f32c000c3b97a3c55ca31.tar.gz
sssd-7c7de044bb08aa6b5c9f32c000c3b97a3c55ca31.tar.xz
sssd-7c7de044bb08aa6b5c9f32c000c3b97a3c55ca31.zip
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.
Diffstat (limited to 'server/providers/ldap/ldap_id_cleanup.c')
-rw-r--r--server/providers/ldap/ldap_id_cleanup.c6
1 files changed, 3 insertions, 3 deletions
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;
}