packager: JSTransform cleanup: remove transformTimeoutInterval
Summary: It's not used in any callsite. Reviewed By: cpojer Differential Revision: D4481683 fbshipit-source-id: 3fa55693f5f56b4fb6c455ad77d7780f69be81a9
This commit is contained in:
parent
a28f1536c8
commit
a10824c9c7
|
@ -29,7 +29,7 @@ import type {SourceMap} from '../lib/SourceMap';
|
||||||
const MAX_CALLS_PER_WORKER = 600;
|
const MAX_CALLS_PER_WORKER = 600;
|
||||||
|
|
||||||
// Worker will timeout if one of the callers timeout.
|
// Worker will timeout if one of the callers timeout.
|
||||||
const DEFAULT_MAX_CALL_TIME = 301000;
|
const TRANSFORM_TIMEOUT_INTERVAL = 301000;
|
||||||
|
|
||||||
// How may times can we tolerate failures from the worker.
|
// How may times can we tolerate failures from the worker.
|
||||||
const MAX_RETRIES = 2;
|
const MAX_RETRIES = 2;
|
||||||
|
@ -39,10 +39,6 @@ const validateOpts = declareOpts({
|
||||||
type:'string',
|
type:'string',
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
transformTimeoutInterval: {
|
|
||||||
type: 'number',
|
|
||||||
default: DEFAULT_MAX_CALL_TIME,
|
|
||||||
},
|
|
||||||
worker: {
|
worker: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
|
@ -54,7 +50,6 @@ const validateOpts = declareOpts({
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
transformModulePath?: ?string,
|
transformModulePath?: ?string,
|
||||||
transformTimeoutInterval?: ?number,
|
|
||||||
worker?: ?string,
|
worker?: ?string,
|
||||||
methods?: ?Array<string>,
|
methods?: ?Array<string>,
|
||||||
};
|
};
|
||||||
|
@ -95,7 +90,6 @@ class Transformer {
|
||||||
|
|
||||||
_opts: {
|
_opts: {
|
||||||
transformModulePath?: ?string,
|
transformModulePath?: ?string,
|
||||||
transformTimeoutInterval: number,
|
|
||||||
worker: ?string,
|
worker: ?string,
|
||||||
methods: Array<string>,
|
methods: Array<string>,
|
||||||
};
|
};
|
||||||
|
@ -120,7 +114,7 @@ class Transformer {
|
||||||
|
|
||||||
if (opts.worker) {
|
if (opts.worker) {
|
||||||
this._workers =
|
this._workers =
|
||||||
makeFarm(opts.worker, opts.methods, opts.transformTimeoutInterval);
|
makeFarm(opts.worker, opts.methods, TRANSFORM_TIMEOUT_INTERVAL);
|
||||||
opts.methods.forEach(name => {
|
opts.methods.forEach(name => {
|
||||||
/* $FlowFixMe: assigning the class object fields directly is
|
/* $FlowFixMe: assigning the class object fields directly is
|
||||||
* questionable, because it's prone to conflicts. */
|
* questionable, because it's prone to conflicts. */
|
||||||
|
@ -133,7 +127,7 @@ class Transformer {
|
||||||
this._workers = makeFarm(
|
this._workers = makeFarm(
|
||||||
require.resolve('./worker'),
|
require.resolve('./worker'),
|
||||||
['minify', 'transformAndExtractDependencies'],
|
['minify', 'transformAndExtractDependencies'],
|
||||||
opts.transformTimeoutInterval,
|
TRANSFORM_TIMEOUT_INTERVAL,
|
||||||
);
|
);
|
||||||
this._transform = denodeify(this._workers.transformAndExtractDependencies);
|
this._transform = denodeify(this._workers.transformAndExtractDependencies);
|
||||||
this.minify = denodeify(this._workers.minify);
|
this.minify = denodeify(this._workers.minify);
|
||||||
|
@ -162,7 +156,7 @@ class Transformer {
|
||||||
if (error.type === 'TimeoutError') {
|
if (error.type === 'TimeoutError') {
|
||||||
const timeoutErr = new Error(
|
const timeoutErr = new Error(
|
||||||
`TimeoutError: transforming ${fileName} took longer than ` +
|
`TimeoutError: transforming ${fileName} took longer than ` +
|
||||||
`${this._opts.transformTimeoutInterval / 1000} seconds.\n` +
|
`${TRANSFORM_TIMEOUT_INTERVAL / 1000} seconds.\n` +
|
||||||
'You can adjust timeout via the \'transformTimeoutInterval\' option'
|
'You can adjust timeout via the \'transformTimeoutInterval\' option'
|
||||||
);
|
);
|
||||||
/* $FlowFixMe: monkey-patch Error */
|
/* $FlowFixMe: monkey-patch Error */
|
||||||
|
|
Loading…
Reference in New Issue