From b72530bc4b3a352463cfed55b2daf84c23991506 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 8 Dec 2015 11:10:49 -0500 Subject: [PATCH] rgw: start pushing current period on startup Signed-off-by: Casey Bodley --- src/rgw/rgw_period_pusher.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_period_pusher.cc b/src/rgw/rgw_period_pusher.cc index 7669631f10b3f..e6c87f794be85 100644 --- a/src/rgw/rgw_period_pusher.cc +++ b/src/rgw/rgw_period_pusher.cc @@ -152,7 +152,23 @@ class RGWPeriodPusher::CRThread { RGWPeriodPusher::RGWPeriodPusher(RGWRados* store) : cct(store->ctx()), store(store) -{} +{ + const auto& realm = store->realm; + auto& realm_id = realm.get_id(); + if (realm_id.empty()) // no realm configuration + return; + + // always send out the current period on startup + RGWPeriod period; + int r = period.init(cct, store, realm_id, realm.get_name()); + if (r < 0) { + lderr(cct) << "failed to load period for realm " << realm_id << dendl; + return; + } + + std::lock_guard lock(mutex); + handle_notify(std::move(period)); +} // destructor is here because CRThread is incomplete in the header RGWPeriodPusher::~RGWPeriodPusher() = default; -- 2.39.5