Skip to content

Commit

Permalink
fix timeout problem
Browse files Browse the repository at this point in the history
  • Loading branch information
kuenishi committed Nov 15, 2011
1 parent 30f326f commit c1ad24e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/common/zk.cpp
Expand Up @@ -44,7 +44,10 @@ namespace jubatus{
}

do{
zh_ = zookeeper_init(hosts.c_str(), NULL, timeout, 0, NULL, 0);
// FIXME?: this loop will call zookeeper_init many times till
// the state got ZOO_CONNECTING_STAT
// timeout is supposed to be ms??
zh_ = zookeeper_init(hosts.c_str(), NULL, timeout * 1000, 0, NULL, 0);
if(zh_ == NULL){
perror("");
throw std::runtime_error("cannot init zk");
Expand Down
3 changes: 2 additions & 1 deletion src/common/zk.hpp
Expand Up @@ -34,7 +34,8 @@ namespace jubatus{
// TODO: write zk mock and test them all?
class zk{
public:
zk(const std::string& hosts, int timeout = 1024, const std::string& logfile = "");
// timeout [ms]
zk(const std::string& hosts, int timeout = 10, const std::string& logfile = "");
~zk();

void create(const std::string& path, const std::string& payload = "", bool ephemeral = false);
Expand Down
2 changes: 1 addition & 1 deletion src/server/classifier.cpp
Expand Up @@ -58,7 +58,7 @@ int main(int argc, char *argv[])
cmdline::parser p;
p.add<int>("rpc-port", 'p', "port number", false, 9199);
p.add<int>("thread", 'c', "thread number", false, 2);
p.add<int>("timeout", 't', "time out", false, 10);
p.add<int>("timeout", 't', "time out (sec)", false, 10);
p.add<std::string>("storage", 'S', "storage type", false, "local");
p.add<std::string>("zookeeper", 'z', "zookeeper location", false);
p.add<std::string>("name", 'n', "learning machine instance name", true);
Expand Down

0 comments on commit c1ad24e

Please sign in to comment.