Skip to content

Commit 23efcba

Browse files
committed
Send notify_price_sched messages if either the primary or the secondary
network are connected.
1 parent f353b2d commit 23efcba

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

pc/manager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,9 @@ void manager::poll( bool do_wait )
572572
}
573573
}
574574

575+
// request product quotes from publishers
576+
poll_schedule();
577+
575578
// try to (re)connect to tx proxy
576579
if ( do_tx_ && ( !tconn_.get_is_connect() || tconn_.get_is_err() ) ) {
577580
tconn_.reconnect();
@@ -580,9 +583,6 @@ void manager::poll( bool do_wait )
580583
if ( has_status( PC_PYTH_RPC_CONNECTED ) &&
581584
!hconn_.get_is_err() &&
582585
( !wconn_ || !wconn_->get_is_err() ) ) {
583-
// request product quotes from pythd's clients while connected
584-
poll_schedule();
585-
586586
send_pending_ups();
587587
} else {
588588
reconnect_rpc();

pc/request.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,9 +1101,21 @@ uint64_t price_sched::get_hash() const
11011101
bool price_sched::get_is_ready()
11021102
{
11031103
manager *cptr = get_manager();
1104-
return cptr->has_status( PC_PYTH_RPC_CONNECTED |
1105-
PC_PYTH_HAS_BLOCK_HASH |
1106-
PC_PYTH_HAS_MAPPING );
1104+
1105+
bool primary_ready = cptr->has_status(
1106+
PC_PYTH_RPC_CONNECTED |
1107+
PC_PYTH_HAS_BLOCK_HASH |
1108+
PC_PYTH_HAS_MAPPING
1109+
);
1110+
1111+
bool secondary_ready = cptr->has_secondary() &&
1112+
cptr->get_secondary()->has_status(
1113+
PC_PYTH_RPC_CONNECTED |
1114+
PC_PYTH_HAS_BLOCK_HASH |
1115+
PC_PYTH_HAS_MAPPING
1116+
);
1117+
1118+
return primary_ready || secondary_ready;
11071119
}
11081120

11091121
void price_sched::submit()

pc/user.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ void user::parse_sub_price_sched( uint32_t tok, uint32_t itok )
274274
pub_key pkey;
275275
pkey.init_from_text( jp_.get_str( ntok ) );
276276
price *sptr = sptr_->get_price( pkey );
277+
if ( PC_UNLIKELY( !sptr && sptr_->has_secondary() ) ) {
278+
sptr = sptr_->get_secondary()->get_price( pkey );
279+
}
280+
277281
if ( PC_UNLIKELY( !sptr ) ) { add_unknown_symbol(itok); return; }
278282

279283
// add subscription

0 commit comments

Comments
 (0)