Last active
February 23, 2019 20:44
-
-
Save uditalias/f3075e877a6be74524e68d167944e7e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@cache({ maxAge: TEN_MINUTES_IN_MILLISECONDS, multi: true }) | |
public async generate(owner: string, repo: string, options: ILangaugeOptions): Promise<Buffer> { | |
try { | |
const createRenderer = this.rendererCreators[options.type]; | |
let languages = await this.githubService.getRepositoryLanguages(owner, repo); | |
if (options.threshold) { | |
languages = this.thresholdLanguagesFilter(languages, options.threshold); | |
} | |
const totalBytes = _(languages).values().sum(); | |
const renderer = createRenderer(options, totalBytes, languages); | |
return await renderer.render(); | |
} catch (err) { | |
this.logger.error(`failed to render langauge for type ${options.type}`, err); | |
return Buffer.from(""); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment