diff options
Diffstat (limited to 'src/mongo/client/fetcher.cpp')
-rw-r--r-- | src/mongo/client/fetcher.cpp | 16 |
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()) { |