FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Revert "Merge pull request #9787 from guardian/revert-play-upgrade" · devhttps/frontend@4642d04 · GitHub

Revert "Merge pull request #9787 from guardian/revert-play-upgrade" · devhttps/frontend@4642d04 · GitHub
Skip to content

Navigation Menu

Commit 4642d04

Browse files
Richard Nguyen
committed
Revert "Merge pull request guardian#9787 from guardian/revert-play-upgrade"
This reverts commit 3441726, reversing changes made to a284ced.
1 parent 3441726 commit 4642d04

162 files changed

Lines changed: 1434 additions & 1683 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎admin/app/Global.scala‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import common.CloudWatchApplicationMetrics
2-
import conf.Gzipper
2+
import conf.{SwitchboardLifecycle, Gzipper}
33
import dfp.{DfpAgentLifecycle, DfpDataCacheLifecycle}
44
import model.AdminLifecycle
55
import ophan.SurgingContentAgentLifecycle
@@ -8,6 +8,7 @@ import scala.concurrent.Future
88

99
object Global extends WithFilters(Gzipper)
1010
with AdminLifecycle
11+
with SwitchboardLifecycle
1112
with CloudWatchApplicationMetrics
1213
with Results
1314
with SurgingContentAgentLifecycle

‎admin/app/commercial/TravelOffersCacheJob.scala‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import scala.concurrent.{Future, future}
1414
object TravelOffersCacheJob extends ExecutionContexts with Dates with Logging {
1515

1616
protected val url = traveloffers_url
17-
// following RFC-2616#3.7.1
18-
protected val characterEncoding: String = AsyncHttpProviderUtils.DEFAULT_CHARSET
1917

2018
protected val loadTimeout: Int = 60000
2119

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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+

‎admin/app/jobs/RefreshFrontsJob.scala‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object HighFrequency extends FrontType {
1818
case class CronUpdate(path: String, frontType: FrontType)
1919

2020
object RefreshFrontsJob extends Logging {
21-
def getCronUpdates: Option[Seq[CronUpdate]] = {
21+
def getAllCronUpdates: Option[Seq[CronUpdate]] = {
2222
val masterConfigJson: Option[JsValue] = S3FrontsApi.getMasterConfig.map(Json.parse)
2323
for (json <- masterConfigJson)
2424
yield
@@ -44,7 +44,7 @@ object RefreshFrontsJob extends Logging {
4444
log.info("Putting press jobs on Facia Cron (High Frequency)")
4545

4646
for {
47-
updates <- getCronUpdates
47+
updates <- getAllCronUpdates
4848
update <- updates.filter(_.frontType == HighFrequency)
4949
} {
5050
log.info(s"Pressing $update")
@@ -60,7 +60,7 @@ object RefreshFrontsJob extends Logging {
6060
log.info("Putting press jobs on Facia Cron (Standard Frequency)")
6161

6262
for {
63-
updates <- getCronUpdates
63+
updates <- getAllCronUpdates
6464
update <- updates.filter(_.frontType == StandardFrequency)
6565
} {
6666
log.info(s"Pressing $update")
@@ -76,7 +76,7 @@ object RefreshFrontsJob extends Logging {
7676
log.info("Putting press jobs on Facia Cron (Commercial Frequency)")
7777

7878
for {
79-
updates <- getCronUpdates
79+
updates <- getAllCronUpdates
8080
update <- updates.filter(_.frontType == LowFrequency)
8181
} {
8282
log.info(s"Pressing $update")
@@ -86,4 +86,16 @@ object RefreshFrontsJob extends Logging {
8686
log.info("Not pressing jobs to Facia cron - is either turned off or no queue is set")
8787
}
8888
}
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+
}
89101
}

‎admin/app/jobs/SentryReportJob.scala‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object SentryReportJob extends ExecutionContexts with Logging with SentryDb {
1414

1515
val dateFormatGeneration: DateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd")
1616

17-
implicit def rowToDateTime: Column[DateTime] = Column.nonNull { (value, meta) =>
17+
implicit def rowToDateTime: Column[DateTime] = Column.nonNull1 { (value, meta) =>
1818
val MetaDataItem(qualified, nullable, clazz) = meta
1919
value match {
2020
case ts: java.sql.Timestamp => Right(new DateTime(ts.getTime))
@@ -43,9 +43,9 @@ object SentryReportJob extends ExecutionContexts with Logging with SentryDb {
4343
"""
4444
)
4545

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
4949

5050
sentryReportAgent.send{
5151
old =>

‎admin/app/jobs/TravelOffersCacheJob.scala‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import scala.concurrent.Future
1414
object TravelOffersCacheJob extends ExecutionContexts with Dates with Logging {
1515

1616
protected val url = traveloffers_url
17-
// following RFC-2616#3.7.1
18-
protected val characterEncoding: String = AsyncHttpProviderUtils.DEFAULT_CHARSET
1917

2018
protected val loadTimeout: Int = 60000
2119

‎admin/app/services/Omniture.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ object Omniture extends ExecutionContexts with Logging {
207207
val segments = Json.parse(response.body).asInstanceOf[JsArray](0) \ "segments"
208208
segments.validate[Seq[OmnitureSegment]] match {
209209
case JsSuccess(segments, _) => segments
210-
case JsError(e) => throw OmnitureException(JsError.toFlatJson(e).toString())
210+
case JsError(e) => throw OmnitureException(JsError.toJson(e).toString())
211211
}
212212
}
213213
case _ => throw OmnitureException(s"Omniture returned: ${response.status}, body:${response.body}")

‎admin/conf/application.conf‎

Lines changed: 40 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,52 @@
1-
# This is the main configuration file for the application.
2-
# ~~~~~
31

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
4010
}
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
4616
}
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
5222
}
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
5828
}
5929
}
6030
}
6131
}
6232

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+
6350
guardian: {
6451
projectName: admin,
6552
secure: true

‎admin/conf/play.plugins‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎admin/conf/routes‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ GET /assets/*path
2323
GET / controllers.admin.AdminIndexController.index()
2424
GET /admin controllers.admin.AdminIndexController.admin()
2525

26+
#Facia Press
27+
GET /press/all controllers.FrontPressController.queueAllFrontsForPress()
28+
2629
# API endpoint proxying for https
2730
GET /api/proxy/*path controllers.admin.Api.proxy(path, callback)
2831
GET /api/tag controllers.admin.Api.tag(q, callback)

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.

Back | FazBrowse Home | New Git URL