| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/** |
| 2 |
|
|
* This file is part of the CernVM File System. |
| 3 |
|
|
*/ |
| 4 |
|
|
|
| 5 |
|
|
#include "subscriber_supervisor.h" |
| 6 |
|
|
|
| 7 |
|
|
#include "subscriber.h" |
| 8 |
|
|
#include "util/logging.h" |
| 9 |
|
|
|
| 10 |
|
|
namespace { |
| 11 |
|
|
|
| 12 |
|
|
const LogFacilities &kLogInfo = DefaultLogging::info; |
| 13 |
|
|
const LogFacilities &kLogError = DefaultLogging::error; |
| 14 |
|
|
|
| 15 |
|
|
} // namespace |
| 16 |
|
|
|
| 17 |
|
|
namespace notify { |
| 18 |
|
|
|
| 19 |
|
✗ |
SubscriberSupervisor::SubscriberSupervisor(notify::Subscriber *s, std::string t, |
| 20 |
|
✗ |
int max_retries, uint64_t interval) |
| 21 |
|
✗ |
: Supervisor(max_retries, interval), subscriber_(s), topic_(t) { } |
| 22 |
|
|
|
| 23 |
|
✗ |
SubscriberSupervisor::~SubscriberSupervisor() { } |
| 24 |
|
|
|
| 25 |
|
✗ |
bool SubscriberSupervisor::Task() { |
| 26 |
|
✗ |
const bool ret = subscriber_->Subscribe(topic_); |
| 27 |
|
✗ |
if (ret) { |
| 28 |
|
✗ |
LogCvmfs( |
| 29 |
|
✗ |
kLogCvmfs, kLogInfo, |
| 30 |
|
|
"SubscriberSupervisor - Subscription ended successfully. Stopping."); |
| 31 |
|
|
} else { |
| 32 |
|
✗ |
LogCvmfs(kLogCvmfs, kLogError, |
| 33 |
|
|
"SubscriberSupervisor - Subscription failed. Retrying."); |
| 34 |
|
|
} |
| 35 |
|
✗ |
return ret; |
| 36 |
|
|
} |
| 37 |
|
|
|
| 38 |
|
|
} // namespace notify |
| 39 |
|
|
|