mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
Handle SSM cache miss when rendering markdown.
SSM cache misses are possible when rendering markdown on print or offline calls as these calls can be made long after the slideshow itself has been rendered in the browser. To ensure YAML config options are always applied on rendering reconstitute SSM from YAML-on-disk if a cache miss occurs.
This commit is contained in:
parent
e05061ff0d
commit
b294a7c46c
|
@ -322,10 +322,25 @@ public class GitService {
|
|||
if (downStatus == STATUS_OK) {
|
||||
|
||||
String ssmKey = SlideshowModel.genKey(pp);
|
||||
Optional<SlideshowModel> ssm =
|
||||
Optional<SlideshowModel> ssmo =
|
||||
Optional.ofNullable(pitchCache.get(ssmKey));
|
||||
|
||||
/*
|
||||
* The SSM in the pitchCache can be absent if
|
||||
* we are currently processing a print or offline
|
||||
* download. In these caes, quickly reconstitute
|
||||
* the SSM using YAML on disk so markdown rendering
|
||||
* can honor all custom YAML configurations.
|
||||
*/
|
||||
if(!ssmo.isPresent()) {
|
||||
|
||||
SlideshowModel ssm =
|
||||
SlideshowModel.build(pp, true, grsService, diskService);
|
||||
ssmo = Optional.of(ssm);
|
||||
}
|
||||
|
||||
MarkdownRenderer mrndr = MarkdownRenderer.build(pp,
|
||||
ssm, grsService, diskService);
|
||||
ssmo, grsService, diskService);
|
||||
|
||||
// MarkdownModel mdm = MarkdownModel.consume(mrndr);
|
||||
MarkdownModel mdm =
|
||||
|
|
Loading…
Reference in New Issue
Block a user