Skip to content

Commit

Permalink
modelinks-139: revert back changes intended for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mukhiddin-yusuf committed Nov 16, 2023
1 parent 9baa10c commit 56ddd87
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@
{
"methods": [ "POST" ],
"pathPattern": "/authority-storage/expire/authorities",
"unit": "minute",
"unit": "day",
"delay": "1",
"modulePermissions": [
"mod-settings.entries.collection.get",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
Expand Down Expand Up @@ -49,7 +50,16 @@ public ResponseEntity<Void> updateAuthority(UUID id, AuthorityDto authority) {
return ResponseEntity.noContent().build();
}

@Override
/**
* POST /authority-storage/expire/authorities.
*
* @return Successfully published authorities expire job (status code 202)
* or Internal server error. (status code 500)
*/
@PostMapping(
value = "/authority-storage/expire/authorities",
produces = { "application/json" }
)
public ResponseEntity<Void> expireAuthorities() {
authorityArchiveServiceDelegate.expire();
return ResponseEntity.status(HttpStatus.ACCEPTED).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ public void expire() {
}

var tillDate = LocalDateTime.now().minus(retention.get(), ChronoUnit.DAYS);
log.info("Querying authority archives last updated before date: {}", tillDate);
try (Stream<AuthorityArchive> archives = authorityArchiveRepository.streamByUpdatedTillDate(tillDate)) {
archives.forEach(authorityArchiveService::delete);
}
}

private Optional<Integer> fetchAuthoritiesRetentionDuration() {
log.info("Fetching the expiration settings");
Optional<SettingsClient.SettingEntry> expireSetting = settingsService.getAuthorityExpireSetting();

if (expireSetting.isPresent() && expireSetting.get().value() != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AuthorityArchiveService {

@Transactional(propagation = Propagation.REQUIRES_NEW)
public void delete(AuthorityArchive authorityArchive) {
log.info("Deleting authority archive: id = {}", authorityArchive.getId());
log.debug("Deleting authority archive: id = {}", authorityArchive.getId());
repository.delete(authorityArchive);
}
}
3 changes: 0 additions & 3 deletions src/main/resources/swagger.api/mod-entities-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,6 @@ paths:
/authority-source-files/{id}:
$ref: './paths/authority-source-files/authority-source-files-by-id.yaml'

/authority-storage/expire/authorities:
$ref: './paths/authority-storage/expire-authorities.yaml'

components:
schemas:
instanceLinkDtoCollection:
Expand Down

This file was deleted.

0 comments on commit 56ddd87

Please sign in to comment.