Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// The presence of a server in the map implies it's likely that there is an
// entry in cachedRegionLocations that map to this server; but the absence
// of a server in this map guarentees that there is no entry in cache that
// maps to the absent server.
this.cachedServers = {};
// region cache prefetch is enabled by default. this set contains all
// tables whose region cache prefetch are disabled.
this.regionCachePrefetchDisabledTables = {};
this.prefetchRegionLimit = options.prefetchRegionLimit || HConstants.DEFAULT_HBASE_CLIENT_PREFETCH_LIMIT;
this.numRetries = options.numRetries || HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER;
this.maxActionRetries = options.maxActionRetries || 3;
this.ensureZookeeperTrackers(utility.noop);
}
// upload to NFS
logger.syncInfo('[%s] uploading %s to nfs:%s', this.category, filepath, args.key);
var result = yield nfs.upload(filepath, args);
debug(result);
info.url = result.url || result.key;
info.size = dataSize;
info.sha1 = sha1sum;
info.md5 = md5sum;
info.category = this.category;
logger.syncInfo('[%s] upload %s to nfs:%s with size:%s, sha1:%s, md5: %s',
this.category, args.key, info.url, bytes(info.size), info.sha1, info.md5);
} finally {
// remove tmp file whatever
fs.unlink(filepath, utility.noop);
}
logger.syncInfo('[%s] Sync dist file: %j done', this.category, info);
yield distService.savefile(info);
};
exports.send = function (to, subject, html, callback) {
callback = callback || utility.noop;
if (mailConfig.enable === false) {
console.log('[send mail debug] [%s] to: %s, subject: %s\n%s', Date(), to, subject, html);
return callback();
}
if (!transport) {
transport = nodemailer.createTransport(smtpConfig);
}
var message = {
from: mailConfig.from || mailConfig.sender,
to: to,
subject: subject,
html: html,
};
function cleanup() {
debug('cleanup %s', tmpPath);
fs.unlink(tmpPath, utility.noop);
}
debug('downloadAsReadStream() %s to %s', key, tmpPath);
{cwd: directory}, proxy.done('config'));
});
proxy.once('config', function () {
child_process.exec('git pull origin master', {cwd: directory}, function (err, data) {
callback && callback(null, err && err.message);
});
});
if (fs.existsSync(directory)) {
child_process.exec('git init && git remote add origin ' + url,
{cwd: directory}, proxy.done('init'));
} else {
child_process.exec('git clone ' + url + ' ' + directory,
{cwd: path.dirname(directory), maxBuffer: 2000 * 1024}, proxy.done('init'));
}
}
exports.push(directory, utility.noop);
setInterval(function () {
exports.push(directory, utility.noop);
}, 60 * 60 * 1000);
};
function cleanup() {
debug('cleanup %s', tmpPath);
rimraf(tmpPath, utility.noop);
if (tarball) {
tarball.destroy();
}
}
debug('downloadAsReadStream() %s to %s', key, tmpPath);
function badRequest(res, filePath) {
res.statusCode = 400;
if (filePath) {
fs.unlink(filePath, utility.noop);
}
return res.end();
}
qnClient.uploadFile(filePath, args, function (err, res) {
if (err) {
return callback(err);
}
fs.unlink(filePath, utility.noop);
result.image = {url: res.url};
return callback(null, result);
});
};