Skip to content

Commit

Permalink
#1429 Force the initialisation of the cluster before the schema updater
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jul 9, 2020
1 parent eb464f7 commit 94d70b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions thehive/app/org/thp/thehive/ClusterSetup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ import scala.concurrent.Future
class ClusterSetup @Inject() (
configuration: Configuration,
system: ActorSystem,
applicationLifeCycle: ApplicationLifecycle,
db: Database,
injector: Injector
) {
applicationLifeCycle
.addStopHook(() => Future.successful(db.close()))
if (configuration.get[Seq[String]]("akka.cluster.seed-nodes").isEmpty) {
val logger: Logger = Logger(getClass)
logger.info("Initialising cluster")
Expand Down
4 changes: 3 additions & 1 deletion thehive/app/org/thp/thehive/models/SchemaUpdaterActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import akka.util.Timeout
import javax.inject.{Inject, Provider, Singleton}
import org.thp.scalligraph.janus.JanusDatabase
import org.thp.scalligraph.models.Database
import org.thp.thehive.ClusterSetup
import org.thp.thehive.services.LocalUserSrv
import play.api.Logger

Expand All @@ -18,7 +19,8 @@ import scala.util.{Failure, Try}
class DatabaseProvider @Inject() (
database: Database,
theHiveSchema: TheHiveSchemaDefinition,
actorSystem: ActorSystem
actorSystem: ActorSystem,
clusterSetup: ClusterSetup
) extends Provider[Database] {
import SchemaUpdaterActor._
lazy val schemaUpdaterActor: ActorRef = {
Expand Down

0 comments on commit 94d70b7

Please sign in to comment.