Commits

Aristarkh Zagorodnikov committed 517c3cb

Fixed initial connect failure not being auto-retried

Comments (0)

Files changed (1)

gridfs/mod_gridfs.cpp

 		const apr_time_t retry_threshold = request->request_time + apr_time_from_sec(config->connect_timeout);
 		while (true)
 		{
-			std::auto_ptr<mongo::ScopedDbConnection> connection(mongo::ScopedDbConnection::getScopedDbConnection(*config->connection_string, config->connect_timeout));
 			try
 			{
+				std::auto_ptr<mongo::ScopedDbConnection> connection(mongo::ScopedDbConnection::getScopedDbConnection(*config->connection_string, config->connect_timeout));
 				const mongo::GridFS gridfs(connection->conn(), *config->database);
 				mongo::GridFile gridfile = gridfs.findFile(filename, config->slave_ok);
 				if (!gridfile.exists())
 				case 10009:	//	ReplicaSetMonitor no master found for set
 				case 10276:	//	DBClientBase::findN: transport error
 				case 11002:	//	pool socket exception
-					connection->kill();
 					ap_log_rerror(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, result, request, "mod_gridfs: Retrying after MongoDB exception for file '%s' (code: %d): %s.", filename, code, exception.what()); 
 					break;