summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/wrepl_server/wrepl_scavenging.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source4/wrepl_server/wrepl_scavenging.c b/source4/wrepl_server/wrepl_scavenging.c
index 2988fb6b22..a5275761a0 100644
--- a/source4/wrepl_server/wrepl_scavenging.c
+++ b/source4/wrepl_server/wrepl_scavenging.c
@@ -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;
}