Skip to content

Commit bdf0c87

Browse files
authored
Add log for when retention job starts (#2551)
* Add log for when retention job starts Signed-off-by: wslulciuc <willy@datakin.com> --------- Signed-off-by: wslulciuc <willy@datakin.com>
1 parent 0296114 commit bdf0c87

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

api/src/main/java/marquez/jobs/DbRetentionJob.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
public class DbRetentionJob extends AbstractScheduledService implements Managed {
2727
private static final Duration NO_DELAY = Duration.ofMinutes(0);
2828

29+
/* The retention policy frequency. */
30+
private final int frequencyMins;
31+
2932
/* The number of rows deleted per batch. */
3033
private final int numberOfRowsPerBatch;
3134

@@ -42,10 +45,11 @@ public class DbRetentionJob extends AbstractScheduledService implements Managed
4245
*/
4346
public DbRetentionJob(
4447
@NonNull final Jdbi jdbi, @NonNull final DbRetentionConfig dbRetentionConfig) {
48+
this.frequencyMins = dbRetentionConfig.getFrequencyMins();
4549
this.numberOfRowsPerBatch = dbRetentionConfig.getNumberOfRowsPerBatch();
4650
this.retentionDays = dbRetentionConfig.getRetentionDays();
4751

48-
// Open connection.
52+
// Connection to database retention policy will be applied.
4953
this.jdbi = jdbi;
5054

5155
// Define fixed schedule with no delay.
@@ -61,8 +65,12 @@ protected Scheduler scheduler() {
6165

6266
@Override
6367
public void start() throws Exception {
64-
log.info("Starting db retention job...");
6568
startAsync().awaitRunning();
69+
log.info(
70+
"Started db retention job with retention policy of '{}' days, "
71+
+ "scheduled to be applied every '{}' mins.",
72+
retentionDays,
73+
frequencyMins);
6674
}
6775

6876
@Override

0 commit comments

Comments
 (0)