Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
-Included the collection name (application name) in collection roller…
Browse files Browse the repository at this point in the history
… logs (#62)
  • Loading branch information
raymondblanc authored and afoerster committed Oct 2, 2018
1 parent 4f5a47c commit 2403048
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

package io.phdata.pulse.collectionroller

import java.io.{ File, FileNotFoundException }
import java.io.{File, FileNotFoundException}
import java.nio.file.Paths
import java.time.temporal.ChronoUnit
import java.time.{ Instant, ZoneOffset, ZonedDateTime }
import java.time.{Instant, ZoneOffset, ZonedDateTime}

import cats.data.Validated
import cats.implicits._
Expand Down Expand Up @@ -139,13 +139,9 @@ class CollectionRoller(solrService: SolrService, val now: ZonedDateTime)
result
}

private def latestAliasName(applicationName: String) = s"${applicationName}_latest"

private def getNextCollectionName(applicationName: String) =
s"${applicationName}_$nowSeconds"

private def searchAliasName(name: String) = s"${name}_all"

/**
* - Create a new collection with a newer timestamp
* - Point the 'latest' application at this new collection
Expand Down Expand Up @@ -198,11 +194,11 @@ class CollectionRoller(solrService: SolrService, val now: ZonedDateTime)
val result = daysSinceLastRoll >= application.rollPeriod.getOrElse(DEFAULT_ROLLPERIOD)

if (result) {
logger.info(s"Rolling collection, last rolled on $latestDate")
logger.info(s"Rolling ${application.name} collection, last rolled on $latestDate")
} else {
val daysUntilNextRoll = application.rollPeriod.getOrElse(DEFAULT_ROLLPERIOD) - daysSinceLastRoll
logger.info(
s"No actions needed on collection, last rolled on $latestDate, will roll in $daysUntilNextRoll days")
s"No actions needed on ${application.name} collection, last rolled on $latestDate, will roll in $daysUntilNextRoll days")
}

result
Expand Down Expand Up @@ -284,6 +280,10 @@ class CollectionRoller(solrService: SolrService, val now: ZonedDateTime)
}
}

private def latestAliasName(applicationName: String) = s"${applicationName}_latest"

private def searchAliasName(name: String) = s"${name}_all"

/**
* Delete all collections belonging to an application
*
Expand Down

0 comments on commit 2403048

Please sign in to comment.