r12701: the first scavenging run should happen after half of the renew_interval,
authorStefan Metzmacher <metze@samba.org>
Tue, 3 Jan 2006 20:07:34 +0000 (20:07 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:49:41 +0000 (13:49 -0500)
and not on startup

metze
(This used to be commit fd234ebbac30a10083e2898eb291d8a4fef7198f)

source4/wrepl_server/wrepl_scavenging.c

index 2988fb6b22b5e36f8ef0d3e6d33eebd57e1959af..a5275761a0b1d65e6c71b117fa3317251dd80881 100644 (file)
@@ -360,15 +360,28 @@ NTSTATUS wreplsrv_scavenging_run(struct wreplsrv_service *service)
 {
        NTSTATUS status;
        TALLOC_CTX *tmp_mem;
+       BOOL skip_first_run = False;
 
        if (!timeval_expired(&service->scavenging.next_run)) {
                return NT_STATUS_OK;
        }
 
+       if (timeval_is_zero(&service->scavenging.next_run)) {
+               skip_first_run = True;
+       }
+
        service->scavenging.next_run = timeval_current_ofs(service->config.scavenging_interval, 0);
        status = wreplsrv_periodic_schedule(service, service->config.scavenging_interval);
        NT_STATUS_NOT_OK_RETURN(status);
 
+       /*
+        * if it's the first time this functions is called (startup)
+        * the next_run is zero, in this case we should not do scavenging
+        */
+       if (skip_first_run) {
+               return NT_STATUS_OK;
+       }
+
        if (service->scavenging.processing) {
                return NT_STATUS_OK;
        }