Skip to content

Commit

Permalink
#130 Prevent page timeout when status fails
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Nov 7, 2017
1 parent d5788ed commit 5ce6382
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion thehive-backend/app/controllers/StatusCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import javax.inject.{ Inject, Singleton }

import scala.collection.immutable
import scala.concurrent.{ ExecutionContext, Future }
import scala.util.Try

import play.api.Configuration
import play.api.libs.json.{ JsObject, JsString, Json }
Expand Down Expand Up @@ -31,6 +32,7 @@ class StatusCtrl @Inject() (

@Timed("controllers.StatusCtrl.get")
def get: Action[AnyContent] = Action.async {
val clusterStatusName = Try(dBIndex.clusterStatusName).getOrElse("ERROR")
Future.traverse(connectors)(c c.status.map(c.name _))
.map { connectorStatus
Ok(Json.obj(
Expand All @@ -41,7 +43,7 @@ class StatusCtrl @Inject() (
"Elastic4s" getVersion(classOf[ElasticDsl]),
"ElasticSearch" getVersion(classOf[org.elasticsearch.Build])),
"connectors" JsObject(connectorStatus.toSeq),
"health" Json.obj("elasticsearch" dBIndex.clusterStatusName),
"health" Json.obj("elasticsearch" clusterStatusName),
"config" Json.obj(
"protectDownloadsWith" configuration.get[String]("datastore.attachment.password"),
"authType" (authSrv match {
Expand Down

0 comments on commit 5ce6382

Please sign in to comment.