| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3441726 commit 4642d04
162 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import common.CloudWatchApplicationMetrics | |
| 2 | - import conf.Gzipper | ||
| 2 | + import conf.{SwitchboardLifecycle, Gzipper} | ||
| 3 | 3 | import dfp.{DfpAgentLifecycle, DfpDataCacheLifecycle} | |
| 4 | 4 | import model.AdminLifecycle | |
| 5 | 5 | import ophan.SurgingContentAgentLifecycle | |
@@ -8,6 +8,7 @@ import scala.concurrent.Future | |||
| 8 | 8 | ||
| 9 | 9 | object Global extends WithFilters(Gzipper) | |
| 10 | 10 | with AdminLifecycle | |
| 11 | + with SwitchboardLifecycle | ||
| 11 | 12 | with CloudWatchApplicationMetrics | |
| 12 | 13 | with Results | |
| 13 | 14 | with SurgingContentAgentLifecycle | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,8 +14,6 @@ import scala.concurrent.{Future, future} | |||
| 14 | 14 | object TravelOffersCacheJob extends ExecutionContexts with Dates with Logging { | |
| 15 | 15 | ||
| 16 | 16 | protected val url = traveloffers_url | |
| 17 | - // following RFC-2616#3.7.1 | ||
| 18 | - protected val characterEncoding: String = AsyncHttpProviderUtils.DEFAULT_CHARSET | ||
| 19 | 17 | ||
| 20 | 18 | protected val loadTimeout: Int = 60000 | |
| 21 | 19 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,16 @@ | |||
| 1 | + package controllers | ||
| 2 | + | ||
| 3 | + import common.{ExecutionContexts, Logging} | ||
| 4 | + import controllers.admin.AuthActions | ||
| 5 | + import jobs.RefreshFrontsJob | ||
| 6 | + import play.api.mvc.Controller | ||
| 7 | + | ||
| 8 | + object FrontPressController extends Controller with Logging with AuthLogging with ExecutionContexts { | ||
| 9 | + def queueAllFrontsForPress() = AuthActions.AuthActionTest { request => | ||
| 10 | + RefreshFrontsJob.runAll() match { | ||
| 11 | + case Some(l) => Ok(s"Pushed ${l.length} fronts to the SQS queue") | ||
| 12 | + case None => InternalServerError("Could not push to the SQS queue, is there an SNS topic set? (frontPressSns)") | ||
| 13 | + } | ||
| 14 | + } | ||
| 15 | + } | ||
| 16 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,7 @@ object HighFrequency extends FrontType { | |||
| 18 | 18 | case class CronUpdate(path: String, frontType: FrontType) | |
| 19 | 19 | ||
| 20 | 20 | object RefreshFrontsJob extends Logging { | |
| 21 | - def getCronUpdates: Option[Seq[CronUpdate]] = { | ||
| 21 | + def getAllCronUpdates: Option[Seq[CronUpdate]] = { | ||
| 22 | 22 | val masterConfigJson: Option[JsValue] = S3FrontsApi.getMasterConfig.map(Json.parse) | |
| 23 | 23 | for (json <- masterConfigJson) | |
| 24 | 24 | yield | |
@@ -44,7 +44,7 @@ object RefreshFrontsJob extends Logging { | |||
| 44 | 44 | log.info("Putting press jobs on Facia Cron (High Frequency)") | |
| 45 | 45 | ||
| 46 | 46 | for { | |
| 47 | - updates <- getCronUpdates | ||
| 47 | + updates <- getAllCronUpdates | ||
| 48 | 48 | update <- updates.filter(_.frontType == HighFrequency) | |
| 49 | 49 | } { | |
| 50 | 50 | log.info(s"Pressing $update") | |
@@ -60,7 +60,7 @@ object RefreshFrontsJob extends Logging { | |||
| 60 | 60 | log.info("Putting press jobs on Facia Cron (Standard Frequency)") | |
| 61 | 61 | ||
| 62 | 62 | for { | |
| 63 | - updates <- getCronUpdates | ||
| 63 | + updates <- getAllCronUpdates | ||
| 64 | 64 | update <- updates.filter(_.frontType == StandardFrequency) | |
| 65 | 65 | } { | |
| 66 | 66 | log.info(s"Pressing $update") | |
@@ -76,7 +76,7 @@ object RefreshFrontsJob extends Logging { | |||
| 76 | 76 | log.info("Putting press jobs on Facia Cron (Commercial Frequency)") | |
| 77 | 77 | ||
| 78 | 78 | for { | |
| 79 | - updates <- getCronUpdates | ||
| 79 | + updates <- getAllCronUpdates | ||
| 80 | 80 | update <- updates.filter(_.frontType == LowFrequency) | |
| 81 | 81 | } { | |
| 82 | 82 | log.info(s"Pressing $update") | |
@@ -86,4 +86,16 @@ object RefreshFrontsJob extends Logging { | |||
| 86 | 86 | log.info("Not pressing jobs to Facia cron - is either turned off or no queue is set") | |
| 87 | 87 | } | |
| 88 | 88 | } | |
| 89 | + | ||
| 90 | + //This is used by a route in admin to push ALL paths to the facia-press SQS queue. | ||
| 91 | + //The facia-press boxes will start to pick these off one by one, so there is no direct overloading of these boxes | ||
| 92 | + def runAll(): Option[Seq[Unit]] = { | ||
| 93 | + Configuration.aws.frontPressSns.map(Function.const { | ||
| 94 | + log.info("Putting press jobs on Facia Cron (MANUAL REQUEST)") | ||
| 95 | + | ||
| 96 | + for {update <- getAllCronUpdates.getOrElse(Nil)} | ||
| 97 | + yield { | ||
| 98 | + log.info(s"Pressing $update") | ||
| 99 | + FrontPressNotification.sendWithoutSubject(update.path)}}) | ||
| 100 | + } | ||
| 89 | 101 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,7 @@ object SentryReportJob extends ExecutionContexts with Logging with SentryDb { | |||
| 14 | 14 | ||
| 15 | 15 | val dateFormatGeneration: DateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd") | |
| 16 | 16 | ||
| 17 | - implicit def rowToDateTime: Column[DateTime] = Column.nonNull { (value, meta) => | ||
| 17 | + implicit def rowToDateTime: Column[DateTime] = Column.nonNull1 { (value, meta) => | ||
| 18 | 18 | val MetaDataItem(qualified, nullable, clazz) = meta | |
| 19 | 19 | value match { | |
| 20 | 20 | case ts: java.sql.Timestamp => Right(new DateTime(ts.getTime)) | |
@@ -43,9 +43,9 @@ object SentryReportJob extends ExecutionContexts with Logging with SentryDb { | |||
| 43 | 43 | """ | |
| 44 | 44 | ) | |
| 45 | 45 | ||
| 46 | - val sentryErrorCounts = sentryData().map { | ||
| 47 | - e => (e[DateTime]("datetime"), e[Long]("count")) | ||
| 48 | - }.toList | ||
| 46 | + val sentryErrorCounts : List[(DateTime, Long)] = sentryData.fold(List[(DateTime, Long)]()) { (list, error) => | ||
| 47 | + list :+(error[DateTime]("datetime"), error[Long]("count")) | ||
| 48 | + }.right.get | ||
| 49 | 49 | ||
| 50 | 50 | sentryReportAgent.send{ | |
| 51 | 51 | old => | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,8 +14,6 @@ import scala.concurrent.Future | |||
| 14 | 14 | object TravelOffersCacheJob extends ExecutionContexts with Dates with Logging { | |
| 15 | 15 | ||
| 16 | 16 | protected val url = traveloffers_url | |
| 17 | - // following RFC-2616#3.7.1 | ||
| 18 | - protected val characterEncoding: String = AsyncHttpProviderUtils.DEFAULT_CHARSET | ||
| 19 | 17 | ||
| 20 | 18 | protected val loadTimeout: Int = 60000 | |
| 21 | 19 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -207,7 +207,7 @@ object Omniture extends ExecutionContexts with Logging { | |||
| 207 | 207 | val segments = Json.parse(response.body).asInstanceOf[JsArray](0) \ "segments" | |
| 208 | 208 | segments.validate[Seq[OmnitureSegment]] match { | |
| 209 | 209 | case JsSuccess(segments, _) => segments | |
| 210 | - case JsError(e) => throw OmnitureException(JsError.toFlatJson(e).toString()) | ||
| 210 | + case JsError(e) => throw OmnitureException(JsError.toJson(e).toString()) | ||
| 211 | 211 | } | |
| 212 | 212 | } | |
| 213 | 213 | case _ => throw OmnitureException(s"Omniture returned: ${response.status}, body:${response.body}") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,65 +1,52 @@ | |||
| 1 | - # This is the main configuration file for the application. | ||
| 2 | - # ~~~~~ | ||
| 3 | 1 | ||
| 4 | - application: { | ||
| 5 | - # The secret key is used to secure cryptographics functions. | ||
| 6 | - # If you deploy your application to several instances be sure to use the same key! | ||
| 7 | - secret: ${APP_SECRET} | ||
| 8 | - langs: "en" | ||
| 9 | - } | ||
| 10 | - | ||
| 11 | - ws.compressionEnabled: true | ||
| 12 | - | ||
| 13 | - logger: { | ||
| 14 | - # Even though we configure logback using conf/logger.xml, Play still inherits a standard logback configuration | ||
| 15 | - # which defines 'play' and 'application' loggers which create `logs/application.log`. The default configuration | ||
| 16 | - # also logs ROOT at ERROR which is not useful for us. | ||
| 17 | - root: INFO, | ||
| 18 | - play: INFO, | ||
| 19 | - application: DEBUG | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - ############################################################ | ||
| 24 | - # | ||
| 25 | - # Threadpool config | ||
| 26 | - # see http://www.playframework.com/documentation/2.2.x/ThreadPools | ||
| 27 | - # | ||
| 28 | - ############################################################ | ||
| 29 | - | ||
| 30 | - play { | ||
| 31 | - akka { | ||
| 32 | - akka.loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] | ||
| 33 | - loglevel = WARNING | ||
| 34 | - actor { | ||
| 35 | - default-dispatcher = { | ||
| 36 | - fork-join-executor { | ||
| 37 | - parallelism-factor = 1.0 | ||
| 38 | - parallelism-max = 24 | ||
| 39 | - } | ||
| 2 | + akka { | ||
| 3 | + akka.loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] | ||
| 4 | + loglevel = WARNING | ||
| 5 | + actor { | ||
| 6 | + default-dispatcher = { | ||
| 7 | + fork-join-executor { | ||
| 8 | + parallelism-factor = 1.0 | ||
| 9 | + parallelism-max = 24 | ||
| 40 | 10 | } | |
| 41 | - java-futures = { | ||
| 42 | - fork-join-executor { | ||
| 43 | - parallelism-factor = 1.0 | ||
| 44 | - parallelism-max = 1 | ||
| 45 | - } | ||
| 11 | + } | ||
| 12 | + java-futures = { | ||
| 13 | + fork-join-executor { | ||
| 14 | + parallelism-factor = 1.0 | ||
| 15 | + parallelism-max = 1 | ||
| 46 | 16 | } | |
| 47 | - feed-recorder = { | ||
| 48 | - fork-join-executor { | ||
| 49 | - parallelism-factor = 1.0 | ||
| 50 | - parallelism-max = 1 | ||
| 51 | - } | ||
| 17 | + } | ||
| 18 | + feed-recorder = { | ||
| 19 | + fork-join-executor { | ||
| 20 | + parallelism-factor = 1.0 | ||
| 21 | + parallelism-max = 1 | ||
| 52 | 22 | } | |
| 53 | - memcached = { | ||
| 54 | - fork-join-executor { | ||
| 55 | - parallelism-factor = 1.0 | ||
| 56 | - parallelism-max = 24 | ||
| 57 | - } | ||
| 23 | + } | ||
| 24 | + memcached = { | ||
| 25 | + fork-join-executor { | ||
| 26 | + parallelism-factor = 1.0 | ||
| 27 | + parallelism-max = 24 | ||
| 58 | 28 | } | |
| 59 | 29 | } | |
| 60 | 30 | } | |
| 61 | 31 | } | |
| 62 | 32 | ||
| 33 | + play { | ||
| 34 | + | ||
| 35 | + crypto { | ||
| 36 | + # The secret key is used to secure cryptographics functions. | ||
| 37 | + # If you deploy your application to several instances be sure to use the same key! | ||
| 38 | + secret: ${APP_SECRET} | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + il8n { | ||
| 42 | + langs: "en" | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + ws { | ||
| 46 | + compressionEnabled: true | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + | ||
| 63 | 50 | guardian: { | |
| 64 | 51 | projectName: admin, | |
| 65 | 52 | secure: true | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,9 @@ GET /assets/*path | |||
| 23 | 23 | GET / controllers.admin.AdminIndexController.index() | |
| 24 | 24 | GET /admin controllers.admin.AdminIndexController.admin() | |
| 25 | 25 | ||
| 26 | + #Facia Press | ||
| 27 | + GET /press/all controllers.FrontPressController.queueAllFrontsForPress() | ||
| 28 | + | ||
| 26 | 29 | # API endpoint proxying for https | |
| 27 | 30 | GET /api/proxy/*path controllers.admin.Api.proxy(path, callback) | |
| 28 | 31 | GET /api/tag controllers.admin.Api.tag(q, callback) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments