Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ClementBouvierN <clement.bouvierneveu@rte-france.com>
- Loading branch information
1 parent
38f40a2
commit d07759b
Showing
6 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
services/users/src/main/java/org/opfab/users/scheduledtask/DeleteExpiredLogsScheduler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright (c) 2023, RTE (http://www.rte-france.com) | ||
* See AUTHORS.txt | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
* This file is part of the OperatorFabric project. | ||
*/ | ||
|
||
|
||
package org.opfab.users.scheduledtask; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import org.opfab.useractiontracing.services.UserActionLogService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@Slf4j | ||
@EnableScheduling | ||
public class DeleteExpiredLogsScheduler { | ||
@Autowired | ||
UserActionLogService userActionLogService; | ||
|
||
@Value("${daysBeforeLogExpiration:61}") Integer daysBeforeLogExpiration; | ||
@Value("${hourScheduledForLogsCleaning:0 30 0 * * *}") String hourScheduledForLogsCleaning; | ||
|
||
@Scheduled(cron = "${hourScheduledForLogsCleaning:0 30 0 * * *}") //0 30 0 * * * | ||
public void deleteExpiredLogs() { | ||
userActionLogService.deleteLogsByExpirationDate(daysBeforeLogExpiration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters