SPARK-184 make timeout value from get_bbo() more obvious. This should fix MAIN-75 for the spark branch
This commit is contained in:
1 parent
f30e572f75
commit
f4513c4718
6 files changed
+45
-26
No files matched your search
@@ -236,7 +236,8 @@ struct QueryServerImpl : public IQueryServer {
|
||||
if (HASFLAG(flags, MDRequest::BBO) || HASFLAG(flags, MDRequest::DEPTH)) {
|
||||
PriceSize bid, ask;
|
||||
TimeStamp time(snapshot ? 0 : chan.time());
|
||||
if (handle.get_bbo(time, bid, ask)) {
|
||||
auto result = handle.get_bbo(time, bid, ask);
|
||||
if (result == HandleReadResult::SUCCESS) {
|
||||
auto* p = pupd->mutable_book();
|
||||
convert(bid, p->add_bids());
|
||||
convert(ask, p->add_asks());
|
||||
@@ -253,6 +254,15 @@ struct QueryServerImpl : public IQueryServer {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (result == HandleReadResult::BUSY) {
|
||||
// If we get a busy reading BBO (which happens 1-2x per day for a single relay client)
|
||||
// We move the timestamp back so the next request will try to read this value again.
|
||||
// ALTERNATIVE: We could spin until the value was not busy but it could be that the writer
|
||||
// was context switched out and we will have to wait multiple ms to unblock the request.
|
||||
// This fix assumes it is better to send the update now with 1 stale value than to block the call
|
||||
// and allow all the values to be stale until this one can be read.
|
||||
reply->mutable_channel()->set_time(chan.time());
|
||||
}
|
||||
}
|
||||
if (HASFLAG(flags, MDRequest::LAST_TRADE)) {
|
||||
TimeStamp time(snapshot ? 0 : chan.time());
|
||||
|
||||
Reference in new issue
Block a user