in index.js [121:137]
async function processGitHubIssues(owner, repo, response, page, indexName, logDisplayName) {
console.log(`[${logDisplayName}#${page}] Found ${response.data.length} issues`);
if (response.data.length > 0) {
const issues = response.data.map(issue => convertIssue(owner, repo, issue));
const bulkIssues = getIssueBulkUpdates(indexName, issues);
const updateCacheKey = getCacheKeyUpdate(owner, repo, page, response.headers.etag);
const body = [...bulkIssues, ...updateCacheKey];
console.log(`[${logDisplayName}#${page}] Writing issues and new cache key "${response.headers.etag}" to Elasticsearch`);
const esResult = await client.bulk({ body });
if (esResult.body.errors) {
console.warn(`[${logDisplayName}#${page}] [ERROR] ${JSON.stringify(esResult.body, null, 2)}`);
}
if (esResult.warnings?.length > 0) {
esResult.warnings.forEach(warning => console.warn(`[${logDisplayName}#${page}] [WARN] ${warning}`));
}
}
}