зеркало из https://github.com/microsoft/ghcrawler.git
tweak location of traffic processing
This commit is contained in:
Родитель
1c46bd1afa
Коммит
004e90e682
|
@ -102,8 +102,8 @@ class GitHubProcessor {
|
|||
return document;
|
||||
}
|
||||
|
||||
// reactions
|
||||
// commit comment, issue, issue comment, pull request review comment
|
||||
// reactions
|
||||
// commit comment, issue, issue comment, pull request review comment
|
||||
|
||||
repo(request) {
|
||||
// TODO links to consider
|
||||
|
@ -292,6 +292,38 @@ class GitHubProcessor {
|
|||
return document;
|
||||
}
|
||||
|
||||
traffic(request) {
|
||||
const document = request.document;
|
||||
request.queueChild('referrers', `${request.url}/traffic/popular/referrers`, `urn:repo:${document.id}`);
|
||||
request.queueChild('paths', `${request.url}/traffic/popular/paths`, `urn:repo:${document.id}`);
|
||||
request.queueChild('views', `${request.url}/traffic/views`, `urn:repo:${document.id}`);
|
||||
request.queueChild('clones', `${request.url}/traffic/clones`, `urn:repo:${document.id}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
referrers(request) {
|
||||
return this._trafficChild(request);
|
||||
}
|
||||
|
||||
views(request) {
|
||||
return this._trafficChild(request);
|
||||
}
|
||||
|
||||
clones(request) {
|
||||
return this._trafficChild(request);
|
||||
}
|
||||
|
||||
paths(request) {
|
||||
return this._trafficChild(request);
|
||||
}
|
||||
|
||||
_trafficChild(request) {
|
||||
request.document.id = moment.utc(request.document._metadata.fetchedAt).format('YYYY_MM_DD');
|
||||
request.addSelfLink();
|
||||
request.linkResource('repo', request.context.qualifier);
|
||||
return request.document;
|
||||
}
|
||||
|
||||
// =============== Event Processors ============
|
||||
|
||||
// The events in a repo or org have changed. Go get the latest events, discover any new
|
||||
|
@ -415,7 +447,8 @@ class GitHubProcessor {
|
|||
// let [, repo] = this._addEventBasics(request);
|
||||
// return this._addEventResource(request, repo, 'milestone');
|
||||
let [document] = this._addEventBasics(request);
|
||||
return document; }
|
||||
return document;
|
||||
}
|
||||
|
||||
PageBuildEvent(request) {
|
||||
// TODO complete implementation and add page_build handler
|
||||
|
@ -496,39 +529,6 @@ class GitHubProcessor {
|
|||
return document;
|
||||
}
|
||||
|
||||
traffic(request) {
|
||||
const document = request.document;
|
||||
const context = request.context;
|
||||
request.queueChild('referrers', `${request.url}/traffic/popular/referrers`,`urn:repo:${document.id}`);
|
||||
request.queueChild('paths', `${request.url}/traffic/popular/paths`, `urn:repo:${document.id}`);
|
||||
request.queueChild('views', `${request.url}/traffic/views`,`urn:repo:${document.id}`);
|
||||
request.queueChild('clones', `${request.url}/traffic/clones`,`urn:repo:${document.id}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
referrers(request) {
|
||||
return this._trafficChild(request);
|
||||
}
|
||||
|
||||
views(request) {
|
||||
return this._trafficChild(request);
|
||||
}
|
||||
|
||||
clones(request) {
|
||||
return this._trafficChild(request);
|
||||
}
|
||||
|
||||
paths(request) {
|
||||
return this._trafficChild(request);
|
||||
}
|
||||
|
||||
_trafficChild(request) {
|
||||
request.document.id = moment.utc(request.document._metadata.fetchedAt).format('YYYY_MM_DD');
|
||||
request.addSelfLink();
|
||||
request.linkResource('repo', request.context.qualifier);
|
||||
return request.document;
|
||||
}
|
||||
|
||||
// ================ HELPERS ========================
|
||||
|
||||
_getHandler(request, type = request.type) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче