Skip to content

Commit

Permalink
Implement l..election_participant using l.._runner.
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan committed Jul 3, 2017
1 parent c1fa31d commit cd895cc
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 725 deletions.
11 changes: 3 additions & 8 deletions jb/etcd/election_participant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,9 @@ int main(int argc, char* argv[]) try {
// participant is elected leader ...
jb::etcd::leader_election_participant participant(
queue, etcd_channel, cfg.election_name(), cfg.value(),
[&is_leader](std::future<bool>& f) {
try {
std::cout << "... elected! ..." << std::endl;
is_leader.set_value(f.get());
} catch (...) {
is_leader.set_exception(std::current_exception());
std::cout << "... election failed ..." << std::endl;
}
[&is_leader](bool f) {
std::cout << "... election result! ..." << f << std::endl;
is_leader.set_value(f);
},
// TODO() - make the initial TTL configurable.
std::chrono::seconds(10));
Expand Down

0 comments on commit cd895cc

Please sign in to comment.