From 8a61febbdbad98476cd2b8492caf8776204e8d4b Mon Sep 17 00:00:00 2001 From: Willy Lulciuc Date: Tue, 25 Jul 2023 16:25:50 +0100 Subject: [PATCH] Add log for when retention job starts (#2551) * Add log for when retention job starts Signed-off-by: wslulciuc --------- Signed-off-by: wslulciuc --- api/src/main/java/marquez/jobs/DbRetentionJob.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/marquez/jobs/DbRetentionJob.java b/api/src/main/java/marquez/jobs/DbRetentionJob.java index 40c4fdd403..b481cef7eb 100644 --- a/api/src/main/java/marquez/jobs/DbRetentionJob.java +++ b/api/src/main/java/marquez/jobs/DbRetentionJob.java @@ -26,6 +26,9 @@ public class DbRetentionJob extends AbstractScheduledService implements Managed { private static final Duration NO_DELAY = Duration.ofMinutes(0); + /* The retention policy frequency. */ + private final int frequencyMins; + /* The number of rows deleted per batch. */ private final int numberOfRowsPerBatch; @@ -42,10 +45,11 @@ public class DbRetentionJob extends AbstractScheduledService implements Managed */ public DbRetentionJob( @NonNull final Jdbi jdbi, @NonNull final DbRetentionConfig dbRetentionConfig) { + this.frequencyMins = dbRetentionConfig.getFrequencyMins(); this.numberOfRowsPerBatch = dbRetentionConfig.getNumberOfRowsPerBatch(); this.retentionDays = dbRetentionConfig.getRetentionDays(); - // Open connection. + // Connection to database retention policy will be applied. this.jdbi = jdbi; // Define fixed schedule with no delay. @@ -61,8 +65,12 @@ protected Scheduler scheduler() { @Override public void start() throws Exception { - log.info("Starting db retention job..."); startAsync().awaitRunning(); + log.info( + "Started db retention job with retention policy of '{}' days, " + + "scheduled to be applied every '{}' mins.", + retentionDays, + frequencyMins); } @Override