Skip to content

Commit acc2314

Browse files
author
Jayant Krishnamurthy
committed
pr comments
1 parent e682913 commit acc2314

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pc/user.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,23 +335,23 @@ void user::parse_get_product( uint32_t tok, uint32_t itok )
335335

336336
void user::send_pending_upds()
337337
{
338-
uint32_t n_sent = 0;
338+
uint32_t n_to_send = 0;
339339
int64_t curr_ts = get_now();
340340
if (curr_ts - last_upd_ts_ > PC_FLUSH_INTERVAL) {
341-
n_sent = pending_vec_.size();
341+
n_to_send = pending_vec_.size();
342342
} else if (pending_vec_.size() >= sptr_->get_max_batch_size()) {
343-
n_sent = sptr_->get_max_batch_size();
343+
n_to_send = sptr_->get_max_batch_size();
344344
}
345345

346-
if (n_sent == 0) {
346+
if (n_to_send == 0) {
347347
return;
348348
}
349349

350-
if ( !price::send( pending_vec_.data(), n_sent) ) {
350+
if ( !price::send( pending_vec_.data(), n_to_send) ) {
351351
add_error( 0, PC_BATCH_SEND_FAILED, "batch send failed - please check the pyth logs" );
352352
}
353353

354-
pending_vec_.erase(pending_vec_.begin(), pending_vec_.begin() + n_sent);
354+
pending_vec_.erase(pending_vec_.begin(), pending_vec_.begin() + n_to_send);
355355
last_upd_ts_ = curr_ts;
356356
}
357357

pc/user.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ namespace pc
4545

4646
// send a batch of pending price updates. This function eagerly sends any complete batches.
4747
// It also sends partial batches that have not been completed within a short interval of time.
48+
// At most one complete batch will be sent. Additional price updates remain queued until the next
49+
// time this function is invoked.
4850
void send_pending_upds();
4951

5052
private:

0 commit comments

Comments
 (0)