mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 12:37:32 -06:00
Enqueue running formatters, at least in most cases.
Partial mitigation of #3407; but really we need a more general solution and hopefully one that can support caching, as we run many of the same formatters over and over again during startup.
This commit is contained in:
@@ -80,7 +80,7 @@ export class BaseCompiler {
|
||||
this.llvmIr = new LlvmIrParser(this.compilerProps);
|
||||
this.llvmAst = new LlvmAstParser(this.compilerProps);
|
||||
|
||||
this.formatHandler = new FormattingHandler(this.env.ceProps);
|
||||
this.formatHandler = new FormattingHandler(this.env.ceProps, async job => await this.env.enqueue(job));
|
||||
|
||||
this.toolchainPath = getToolchainPath(this.compiler.exe, this.compiler.options);
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ import { getFormatterTypeByKey } from '../formatters';
|
||||
import { logger } from '../logger';
|
||||
|
||||
export class FormattingHandler {
|
||||
constructor(ceProps) {
|
||||
constructor(ceProps, maybeEnqueue) {
|
||||
this.enqueue = maybeEnqueue || (async job => await job());
|
||||
this.formatters = {};
|
||||
this.ceProps = ceProps;
|
||||
const formatters = _.compact(ceProps('formatters', '').split(':'));
|
||||
@@ -49,7 +50,7 @@ export class FormattingHandler {
|
||||
const versionRe = this.ceProps(`formatter.${formatter}.versionRe`, '.*');
|
||||
const hasExplicitVersion = this.ceProps(`formatter.${formatter}.explicitVersion`, '') !== '';
|
||||
try {
|
||||
const result = await exec.execute(exe, [versionArg], {});
|
||||
const result = await this.enqueue(async () => exec.execute(exe, [versionArg], {}));
|
||||
const match = result.stdout.match(versionRe);
|
||||
const formatterClass = getFormatterTypeByKey(type);
|
||||
const styleList = this.ceProps(`formatter.${formatter}.styles`);
|
||||
|
||||
Reference in New Issue
Block a user