Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editions crossword cryptic and quick data #27604

Merged
merged 5 commits into from
Nov 20, 2024

Conversation

DanielCliftonGuardian
Copy link
Contributor

@DanielCliftonGuardian DanielCliftonGuardian commented Nov 14, 2024

What is the value of this and can you measure success?

This PR adds functionality to the Crosswords Controller to send JSON data for the latest cryptic and quick crosswords to DCR

What does this change?

Resolves guardian/dotcom-rendering#12799

@DanielCliftonGuardian DanielCliftonGuardian changed the title WIP Editions crossword cryptic and quick data Nov 18, 2024
@DanielCliftonGuardian DanielCliftonGuardian marked this pull request as ready for review November 18, 2024 10:32
@DanielCliftonGuardian DanielCliftonGuardian requested a review from a team as a code owner November 18, 2024 10:32
Copy link
Contributor

@JamieB-gu JamieB-gu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Couple of questions.

applications/app/controllers/CrosswordsController.scala Outdated Show resolved Hide resolved
crosswords: EditionsCrosswordRenderingDataModel,
)(implicit request: RequestHeader): Future[Result] = {
val json = EditionsCrosswordRenderingDataModel.toJson(crosswords)
post(ws, json, Configuration.rendering.articleBaseURL + "/EditionsCrossword", CacheTime.Facia)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why CacheTime.Facia?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the other post requests in the DotcomRenderingService are using this cache time including for articles. Its confusingly named, maybe we can look at reviewing this separately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think generally post requests for articles are using a different cache time based on their metadata:

post(ws, json, Configuration.rendering.articleBaseURL + path, page.metadata.cacheTime)

post(ws, json, Configuration.rendering.interactiveBaseURL + "/Interactive", page.metadata.cacheTime, 4.seconds)

with CacheTime.Default as the fallback:

cacheTime: CacheTime = CacheTime.Default,

?

Post requests for fronts and tag pages are using CacheTime.Facia, but that's likely correct because they're examples of "facia" content. I agree that probably we should review getMedia, getImageContent and getGallery's usage of CacheTime.Facia; have captured this in #27628.

Given this, I don't think it's what we want to use here. Perhaps CacheTime.Default is the correct choice if we don't have a specific, different cache setting for these pages? @SiAdcock @arelra any thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I didn't think about this much and just copied what was being done for similar use cases. What about 50 minutes surrogate and 5 minutes for client cache arbitrarily. This is a simple optimisation unlikely to effect users too much unless that are hitting crosswords in press reader at midnight

@DanielCliftonGuardian DanielCliftonGuardian merged commit 7873955 into main Nov 20, 2024
6 checks passed
@DanielCliftonGuardian DanielCliftonGuardian deleted the crossword-dcr-model branch November 20, 2024 14:27
@prout-bot
Copy link
Collaborator

Seen on ADMIN-PROD (merged by @DanielCliftonGuardian 13 minutes and 41 seconds ago)

@prout-bot
Copy link
Collaborator

Seen on FRONTS-PROD (merged by @DanielCliftonGuardian 14 minutes and 1 second ago)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define crossword data model for Guardian Digital Editions
3 participants