[MAGNOLIA-6677] Remove FTL 5sec cache in Developer mode Created: 23/May/16  Updated: 09/Feb/17  Resolved: 11/Jun/16

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 5.4.6
Fix Version/s: 5.4.8, 5.5

Type: Improvement Priority: Major
Reporter: Christopher Zimmermann Assignee: Ilgun Ilgun
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MAGNOLIA-1482 Templates stored in repository Closed
relates to MAGNOLIA-6623 Speed up DirectoryWatcher on OSX in d... Closed
causality
is causing MGNLSTK-1532 Fix failing tests after adjusting the... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Documentation update required:
Yes
Epic Link: LD: Fundamental features
Sprint: Basel 48
Story Points: 2

 Description   

Currently FTL files are cached for 5 seconds when they are requested. In developer mode this should be removed to improve developer experience of the responsiveness of Magnolia to their changes. This will also enable using a "hot browser reload" mechanism like BrowserSync or LiveReload.

Symptom:
Change an ftl file. Refresh the webpage and see the change instantly.
Change the ftl file again. Refresh the webpage before 5 seconds elapsed and you will not see the change. Only after 5 seconds have elapsed since the last change was rendered will the new change be rendered.

Notes:
freemarker.cache.TemplateCache sets the default refresh delay to 5s

The 'FTL lock' problem is solvable by doing this at L123 in FreemarkerHelper:

 cfg.setTemplateUpdateDelay(0);

As this change will negatively impact performance, it should only be appllied when developer mode is enabled.

Documentation:
Please document also in a section about all the changes that developer mode activates.



 Comments   
Comment by Christopher Zimmermann [ 23/May/16 ]

See reason that this line was commented out in https://jira.magnolia-cms.com/browse/MAGNOLIA-1482
Additional hipchat comments from had
As Greg pointed out in the issue, we were loading FTLs only from classpath (where they never changed) or from JCR (where they were wrapped in lazy loader that was replaced when template was modified, so from FM point of view that template also never changed (when it did, whole wrapper was dropped).

If we reinstate the check (which we could), serving templates will take performance impact (at all sources - classpath, JCR and file system). We could of course do that, but I would maybe suggest to do so by default only on author instance and not on public where changes in templates should be much less frequent and performance is much more critical.

Generated at Mon Feb 12 04:16:47 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.