Skip to content

Commit 3dc8dae

Browse files
committed
Start staggering price_sched requests at fixed intervals instead of on a new slot
1 parent 07b0ff5 commit 3dc8dae

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pc/manager.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,15 @@ void manager::poll( bool do_wait )
602602

603603
void manager::poll_schedule()
604604
{
605+
// Enable publishing mode if enough time has elapsed since last time.
606+
int64_t time_since_last_stagger = curr_ts_ - pub_ts_;
607+
if ( !is_pub_ && ( time_since_last_stagger > pub_int_ ) ) {
608+
is_pub_ = true;
609+
kidx_ = 0;
610+
pub_ts_ = curr_ts_;
611+
}
612+
613+
// Schedule the price_sched requests in a staggered fashion.
605614
while ( is_pub_ && kidx_ < kvec_.size() ) {
606615
price_sched *kptr = kvec_[kidx_];
607616
int64_t pub_ts = pub_ts_ + static_cast< int64_t >(
@@ -639,8 +648,6 @@ void manager::reconnect_rpc()
639648

640649
// reset state
641650
wait_conn_ = false;
642-
is_pub_ = false;
643-
kidx_ = 0;
644651
ctimeout_ = PC_NSECS_IN_SEC;
645652
pub_ts_ = 0L;
646653
slot_ = 0L;
@@ -836,13 +843,6 @@ void manager::on_response( rpc::get_slot *res )
836843
clnt_.send( breq_ );
837844
}
838845

839-
// reset submit
840-
if ( !is_pub_ ) {
841-
kidx_ = 0;
842-
pub_ts_ = ts;
843-
is_pub_ = true;
844-
}
845-
846846
// flush capture
847847
if ( do_cap_ ) {
848848
cap_.flush();

0 commit comments

Comments
 (0)