summaryrefslogtreecommitdiff
path: root/src/mongo/client/fetcher.cpp
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2015-09-03 15:19:17 -0400
committerEric Milkie <milkie@10gen.com>2015-09-03 16:02:08 -0400
commit2330fcb66e777d9204351d81fff06798025277d5 (patch)
treeabd13507d2e2e62ed10fed55abe6e5a995fc60ed /src/mongo/client/fetcher.cpp
parenta65cf7d29dc12995b90c9235dcedcceecc42699f (diff)
downloadmongo-2330fcb66e777d9204351d81fff06798025277d5.tar.gz
SERVER-18265 set proper timeout for find/getmore repl commands
This reverts commit cb0630daae67c853a76bb82a25f55c9fef54682d.
Diffstat (limited to 'src/mongo/client/fetcher.cpp')
-rw-r--r--src/mongo/client/fetcher.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mongo/client/fetcher.cpp b/src/mongo/client/fetcher.cpp
index 986e483ffff..f8eba3fd904 100644
--- a/src/mongo/client/fetcher.cpp
+++ b/src/mongo/client/fetcher.cpp
@@ -153,6 +153,16 @@ Fetcher::Fetcher(executor::TaskExecutor* executor,
const BSONObj& findCmdObj,
const CallbackFn& work,
const BSONObj& metadata)
+ : Fetcher(
+ executor, source, dbname, findCmdObj, work, metadata, RemoteCommandRequest::kNoTimeout) {}
+
+Fetcher::Fetcher(executor::TaskExecutor* executor,
+ const HostAndPort& source,
+ const std::string& dbname,
+ const BSONObj& findCmdObj,
+ const CallbackFn& work,
+ const BSONObj& metadata,
+ Milliseconds timeout)
: _executor(executor),
_source(source),
_dbname(dbname),
@@ -161,7 +171,8 @@ Fetcher::Fetcher(executor::TaskExecutor* executor,
_work(work),
_active(false),
_first(true),
- _remoteCommandCallbackHandle() {
+ _remoteCommandCallbackHandle(),
+ _timeout(timeout) {
uassert(ErrorCodes::BadValue, "null replication executor", executor);
uassert(ErrorCodes::BadValue, "database name cannot be empty", !dbname.empty());
uassert(ErrorCodes::BadValue, "command object cannot be empty", !findCmdObj.isEmpty());
@@ -182,6 +193,7 @@ std::string Fetcher::getDiagnosticString() const {
output << " query: " << _cmdObj;
output << " query metadata: " << _metadata;
output << " active: " << _active;
+ output << " timeout: " << _timeout;
return output;
}
@@ -222,7 +234,7 @@ void Fetcher::wait() {
Status Fetcher::_schedule_inlock(const BSONObj& cmdObj, const char* batchFieldName) {
StatusWith<executor::TaskExecutor::CallbackHandle> scheduleResult =
_executor->scheduleRemoteCommand(
- RemoteCommandRequest(_source, _dbname, cmdObj, _metadata),
+ RemoteCommandRequest(_source, _dbname, cmdObj, _metadata, _timeout),
stdx::bind(&Fetcher::_callback, this, stdx::placeholders::_1, batchFieldName));
if (!scheduleResult.isOK()) {