Skip to content

Commit

Permalink
clarify date comparisons when deleting old models/groups (#1733)
Browse files Browse the repository at this point in the history
  • Loading branch information
niehaus59 authored Nov 21, 2022
1 parent 6ea02bd commit 952d1bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class IdentifyFacesSuite extends TransformerFuzzing[IdentifyFaces] with Cognitiv
try {
val pgDateString = pgi.personGroupId.replaceFirst("group", "")
val pgDate = LocalDateTime.parse(pgDateString, DateTimeFormatter.ofPattern(timeFormat))
if (twoDaysAgo.compareTo(pgDate) <= 0) {
if (pgDate.isBefore(twoDaysAgo)) {
PersonGroup.delete(pgi.personGroupId)
println(s"deleted group $pgi")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class FitMultivariateAnomalySuite extends EstimatorFuzzing[FitMultivariateAnomal
models.foreach { modelId =>
val lastUpdated = MADUtils.madGetModel(url, modelId, anomalyKey).parseJson.asJsObject.fields("lastUpdatedTime")
val lastUpdatedTime = stringToTime(lastUpdated.toString().replaceAll("\"", ""))
if (lastUpdatedTime.compareTo(twoDaysAgo) <= 0) {
if (lastUpdatedTime.isBefore(twoDaysAgo)) {
println(s"Deleting $modelId")
MADUtils.madDelete(modelId, anomalyKey, anomalyLocation)
}
Expand Down

0 comments on commit 952d1bd

Please sign in to comment.