- if (prepare_update(op)) {
- double delay = 0.0;
- if (should_propose(delay)) {
- if (delay == 0.0) {
- propose_pending();
- } else {
- // delay a bit
- if (!proposal_timer) {
- /**
- * Callback class used to propose the pending value once the proposal_timer
- * fires up.
- */
- proposal_timer = new C_MonContext(mon, [this](int r) {
- proposal_timer = 0;
- if (r >= 0)
- propose_pending();
- else if (r == -ECANCELED || r == -EAGAIN)
- return;
- else
- assert(0 == "bad return value for proposal_timer");
- });
- dout(10) << " setting proposal_timer " << proposal_timer << " with delay of " << delay << dendl;
- mon->timer.add_event_after(delay, proposal_timer);
- } else {
- dout(10) << " proposal_timer already set" << dendl;
- }
- }
- } else {
- dout(10) << " not proposing" << dendl;
- }
- }
+ if (!prepare_update(op)) {
+ // no changes made.
+ return true;
+ }
+
+ if (need_immediate_propose) {
+ dout(10) << __func__ << " forced immediate propose" << dendl;
+ need_immediate_propose = false;
+ propose_pending();
+ return true;
+ }
+
+ double delay = 0.0;
+ if (!should_propose(delay)) {
+ dout(10) << " not proposing" << dendl;
+ return true;
+ }
+
+ if (delay == 0.0) {
+ propose_pending();
+ return true;
+ }
+
+ // delay a bit
+ if (!proposal_timer) {
+ /**
+ * Callback class used to propose the pending value once the proposal_timer
+ * fires up.
+ */
+ proposal_timer = new C_MonContext(mon, [this](int r) {
+ proposal_timer = 0;
+ if (r >= 0) {
+ propose_pending();
+ } else if (r == -ECANCELED || r == -EAGAIN) {
+ return;
+ } else {
+ assert(0 == "bad return value for proposal_timer");
+ }
+ });
+ dout(10) << " setting proposal_timer " << proposal_timer
+ << " with delay of " << delay << dendl;
+ mon->timer.add_event_after(delay, proposal_timer);
+ } else {
+ dout(10) << " proposal_timer already set" << dendl;
+ }