Cache techdocs build using UrlReader (#3551)

* Better caching is coming when some backstage core features are in place. Currently let's just cache it for 30 minutes

* Fixed prettier
This commit is contained in:
Sebastian Qvarfordt
2020-12-03 15:00:03 +01:00
committed by GitHub
parent 9b234443e7
commit eeecfbf4a6
@@ -120,6 +120,16 @@ export class DocsBuilder {
}
}
// TODO: Better caching for URL.
if (type === 'url') {
const builtAt = buildMetadataStorage.getTimestamp();
const now = Date.now();
if (builtAt > now - 1800000) {
return true;
}
}
this.logger.debug(
`Docs for entity ${getEntityId(this.entity)} was outdated.`,
);