зеркало из https://github.com/microsoft/ghcrawler.git
update for _emitter change
This commit is contained in:
Родитель
1717718490
Коммит
6966e8e41c
|
@ -15,7 +15,7 @@ class Crawler {
|
|||
this.fetcher = fetcher;
|
||||
this.processor = processor;
|
||||
this.options = options;
|
||||
this.options._emitter.on('changed', this._reconfigure.bind(this));
|
||||
this.options._config.on('changed', this._reconfigure.bind(this));
|
||||
this.logger = options.logger;
|
||||
this.counter = 0;
|
||||
this.counterRollover = Number.parseInt('zzz', 36);
|
||||
|
|
|
@ -12,7 +12,7 @@ class GitHubFetcher {
|
|||
this.tokenFactory = tokenFactory;
|
||||
this.options = options;
|
||||
this.logger = options.logger;
|
||||
this.options._emitter.on('changed', this._reconfigure.bind(this));
|
||||
this.options._config.on('changed', this._reconfigure.bind(this));
|
||||
this.getQueue = async.queue(this._callGitHubTask.bind(this), options.concurrency || 5);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class QueueSet {
|
|||
}
|
||||
this.deadletter = deadletter;
|
||||
this.options = options;
|
||||
this.options._emitter.on('changed', this._reconfigure.bind(this));
|
||||
this.options._config.on('changed', this._reconfigure.bind(this));
|
||||
this.startMap = this._createStartMap(this.options.weights || [1]);
|
||||
this.popCount = 0;
|
||||
}
|
||||
|
|
|
@ -1105,7 +1105,7 @@ function createBaseOptions(logger = createBaseLog()) {
|
|||
};
|
||||
for (let name in result) {
|
||||
const subsystemOptions = result[name];
|
||||
subsystemOptions._emitter = { on: () => { } };
|
||||
subsystemOptions._config = { on: () => { } };
|
||||
subsystemOptions.logger = logger;
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -286,7 +286,7 @@ function createBaseOptions(logger = createBaseLog()) {
|
|||
return {
|
||||
fetcher: {
|
||||
logger: logger,
|
||||
_emitter: { on: () => { } },
|
||||
_config: { on: () => { } },
|
||||
tokenLowerBound: 50,
|
||||
forbiddenDelay: 120000
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('QueueSet weighting', () => {
|
|||
});
|
||||
|
||||
it('should create a default startMap if no weights given', () => {
|
||||
const set = new QueueSet([createBaseQueue('1'), createBaseQueue('2')], null, { _emitter: { on: () => { } } });
|
||||
const set = new QueueSet([createBaseQueue('1'), createBaseQueue('2')], null, { _config: { on: () => { } } });
|
||||
expect(set.startMap.length).to.be.equal(1);
|
||||
expect(set.startMap[0]).to.be.equal(0);
|
||||
});
|
||||
|
@ -245,7 +245,7 @@ describe('QueueSet subscription management', () => {
|
|||
function createOptions(weights) {
|
||||
return {
|
||||
weights: weights,
|
||||
_emitter: { on: () => { } }
|
||||
_config: { on: () => { } }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче