2 Commits

Author SHA1 Message Date
4cbde45293 fix: make output less chatty 2019-01-30 10:01:40 -07:00
559c7d64d6 feat: handle termination 2019-01-30 10:01:40 -07:00
3 changed files with 1 additions and 6 deletions

View File

@@ -34,7 +34,6 @@ function handleError(err) {
}
async function fetchAndIndex() {
logger.debug('Fetching and indexing data...');
return mod(index, { elasticsearch: { ...esConfig, auth }, filter: { lat, lon, radius } });
}
@@ -49,7 +48,6 @@ async function run() {
};
process.on('SIGINT', terminate('SIGINT'));
process.on('SIGTERM', terminate('SIGTERM'));
process.on('SIGKILL', terminate('SIGKILL'));
// scheduled running
if (interval === 0) return;

View File

@@ -17,7 +17,6 @@ export default async function(indexName, opts = {}) {
const index = await createIndex(client, indexName);
const records = await getAdbsExchangeData(opts.filter);
logger.debug(`Record count:, ${records.length}`);
await bulkInsert(client, index, records);
logger.debug(`Successfully indexed ${records.length} records to ${index}`);

View File

@@ -58,10 +58,8 @@ export async function createIndex(client, index) {
})
.catch(err => {
// check for existing index
if (err instanceof BadRequest) {
logger.debug(`Index exists: ${realIndex}`);
if (err instanceof BadRequest)
return client.indices.get({ index: realIndex }).then(() => realIndex);
}
throw err;
});