Skip to content

Commit

Permalink
fix(core): Ensure resource is removed from db when deleted (#302)
Browse files Browse the repository at this point in the history
- updated to ensure the deleted resource is removed from the db
  • Loading branch information
jeyrschabu authored Nov 14, 2019
1 parent e816874 commit a3d22fd
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,14 @@ abstract class AbstractResourceTypeHandler<T : Resource>(
val maxItemsToProcess = min(confirmedResourcesToDelete.size, workConfiguration.getMaxItemsProcessedPerCycle(dynamicConfigService))
confirmedResourcesToDelete.subList(0, maxItemsToProcess).let {
partitionList(it, workConfiguration).forEach { partition ->
if (!partition.isEmpty()) {
if (partition.isNotEmpty()) {
try {
deleteResources(partition, workConfiguration)
partition.forEach { it -> applicationEventPublisher.publishEvent(DeleteResourceEvent(it, workConfiguration)) }
partition.forEach { markedResource ->
applicationEventPublisher.publishEvent(DeleteResourceEvent(markedResource, workConfiguration))
resourceRepository.remove(markedResource)
}

candidateCounter.addAndGet(partition.size)
} catch (e: Exception) {
log.error("Failed to delete $it. Configuration: {}", workConfiguration.toLog(), e)
Expand Down

0 comments on commit a3d22fd

Please sign in to comment.