Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
parametalol committed Nov 23, 2023
1 parent f7c8b82 commit 942be5f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/dinosaur/pkg/services/dinosaur.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,11 @@ func (k *dinosaurService) DeprovisionExpiredDinosaurs() *errors.ServiceError {
dbConn := k.connectionFactory.New().Model(&dbapi.CentralRequest{}).
Where("expired_at IS NOT NULL").Where("expired_at < ?", now.Add(-gracePeriod))

if lifespan := k.dinosaurConfig.CentralLifespan; lifespan.EnableDeletionOfExpiredCentral {
if k.dinosaurConfig.CentralLifespan.EnableDeletionOfExpiredCentral {
dbConn = dbConn.Where(dbConn.
Or("instance_type = ?", types.EVAL.String()).
Where("created_at <= ?", now.Add(-1*time.Duration(lifespan.CentralLifespanInHours)*time.Hour)))
Where("created_at <= ?", now.Add(
-time.Duration(k.dinosaurConfig.CentralLifespan.CentralLifespanInHours)*time.Hour)))
}

dbConn = dbConn.Where("status NOT IN (?)", dinosaurDeletionStatuses)
Expand Down

0 comments on commit 942be5f

Please sign in to comment.