Skip to content
Browse files

warehouse: added params for timeout + #retries (#1008)

  • Loading branch information...
dg-shadow authored and rhaschke committed Aug 20, 2018
1 parent 2d27391 commit b79cd2f7f84a3f1a046c52570789f7b02f1a2725
Showing with 17 additions and 4 deletions.
  1. +17 −4 moveit_ros/warehouse/warehouse/src/warehouse_services.cpp
@@ -130,21 +130,34 @@ int main(int argc, char** argv)

ros::NodeHandle node;
std::string host;

int port;
float connection_timeout;
int connection_retries;

node.param<std::string>("warehouse_host", host, "localhost");
node.param<int>("warehouse_port", port, 33829);
node.param<float>("warehouse_db_connection_timeout", connection_timeout, 5.0);
node.param<int>("warehouse_db_connection_retries", connection_retries, 5);

warehouse_ros::DatabaseConnection::Ptr conn;

conn = moveit_warehouse::loadDatabase();
conn->setParams(host, port, 5.0);
conn->setParams(host, port, connection_timeout);

ROS_INFO("Connecting to warehouse on %s:%d", host.c_str(), port);
if (!conn->connect())
int tries = 0;
while (!conn->connect())
ROS_ERROR("Failed to connect to DB on %s:%d", host.c_str(), port);
return 1;
ROS_WARN("Failed to connect to DB on %s:%d (try %d/%d).", host.c_str(), port, tries, connection_retries);
if (tries == connection_retries)
ROS_FATAL("Failed to connect too many times, giving up");
return 1;
catch (std::exception& ex)

0 comments on commit b79cd2f

Please sign in to comment.
You can’t perform that action at this time.