Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pgpatcher(client, level, {dir: path.join(__dirname, 'migrations')}, function onPatched(err, result) {
log.debug('pgpatcher callback fired');
if (err) {
log.error('pgpatcher migration failed: ' + err);
done();
pg.end();
return deferred.reject(err);
}
log.info('pgpatcher migration succeeded');
// at patchLevel 0 and 1, there is no user_pages table to reindex
if (patchLevel < 2) {
done();
pg.end();
return deferred.resolve(result);
}
reindex.start(function(err) {
if (err) {
log.error('elasticsearch reindexing failed: ' + err);
done();
pg.end();
return deferred.reject(err);
}
log.info('elasticsearch reindexing succeeded');
done();
pg.end();
deferred.resolve(result);
});
});
}
process.on('exit', function onExit() {
log.verbose('received exit signal, closing pool');
pg.end();
});
destroy() {
pg.end();
}
close() {
pg.end();
}
LivePg.close = function close(cb) {
if (this.willClose) {
cb();
} else {
pg.once('end', cb);
pg.end();
}
};