mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
Markdown interface across service boundary.
This commit is contained in:
parent
248b91bc07
commit
13dad55e16
|
@ -26,7 +26,7 @@ package com.gitpitch.controllers;
|
|||
import com.gitpitch.git.GRS;
|
||||
import com.gitpitch.git.GRSManager;
|
||||
import com.gitpitch.models.GitRepoModel;
|
||||
import com.gitpitch.models.MarkdownModel;
|
||||
import com.gitpitch.models.Markdown;
|
||||
import com.gitpitch.executors.FrontEndThreads;
|
||||
import com.gitpitch.models.SlideshowModel;
|
||||
import com.gitpitch.services.PitchService;
|
||||
|
@ -207,11 +207,11 @@ public class PitchController extends Controller {
|
|||
PitchParams pp =
|
||||
PitchParams.build(grsOnCall(grs),
|
||||
user, repo, branch, null, pitchme);
|
||||
Optional<MarkdownModel> mdmo = pitchService.cachedMarkdown(pp);
|
||||
Optional<Markdown> mdmo = pitchService.cachedMarkdown(pp);
|
||||
|
||||
if (mdmo.isPresent()) {
|
||||
|
||||
MarkdownModel mdm = mdmo.get();
|
||||
Markdown mdm = mdmo.get();
|
||||
log.info("markdown: [ mdwn, cached, online ] {}", pp);
|
||||
return CompletableFuture.completedFuture(ok(mdm.produce())
|
||||
.as("text/markdown"));
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package com.gitpitch.services;
|
||||
|
||||
import com.gitpitch.models.GitRepoModel;
|
||||
import com.gitpitch.models.Markdown;
|
||||
import com.gitpitch.models.MarkdownModel;
|
||||
import com.gitpitch.models.SlideshowModel;
|
||||
import com.gitpitch.policies.CacheTimeout;
|
||||
|
@ -150,7 +151,7 @@ public class PitchService {
|
|||
/*
|
||||
* Return cached MarkdownModel, else Optional.empty.
|
||||
*/
|
||||
public Optional<MarkdownModel> cachedMarkdown(PitchParams pp) {
|
||||
public Optional<Markdown> cachedMarkdown(PitchParams pp) {
|
||||
|
||||
String mdmKey = MarkdownModel.genKey(pp);
|
||||
return Optional.ofNullable(pitchCache.get(mdmKey));
|
||||
|
@ -159,7 +160,7 @@ public class PitchService {
|
|||
/*
|
||||
* Return RepoModel.
|
||||
*/
|
||||
public MarkdownModel fetchMarkdown(PitchParams pp) {
|
||||
public Markdown fetchMarkdown(PitchParams pp) {
|
||||
|
||||
log.debug("fetchMarkdown: pp={}", pp);
|
||||
CountDownLatch markdownLatch = gitService.fetchMarkdown(pp);
|
||||
|
@ -177,8 +178,8 @@ public class PitchService {
|
|||
log.warn("fetchMarkdown: pp={}, markdownLatch.await ex={}", pp, ex);
|
||||
}
|
||||
|
||||
Optional<MarkdownModel> mdmo = cachedMarkdown(pp);
|
||||
MarkdownModel mdm = mdmo.orElse(null);
|
||||
Optional<Markdown> mdmo = cachedMarkdown(pp);
|
||||
Markdown mdm = mdmo.orElse(null);
|
||||
log.debug("fetchMarkdown: pp={}, returning mdm={}", pp, mdm);
|
||||
|
||||
return mdm;
|
||||
|
|
Loading…
Reference in New Issue
Block a user