tweak location of traffic processing

This commit is contained in:
Jeff McAffer 2016-12-21 15:11:30 -08:00
Родитель 1c46bd1afa
Коммит 004e90e682
1 изменённых файлов: 36 добавлений и 36 удалений

Просмотреть файл

@ -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) {