| 1441 | } |
| 1442 | |
| 1443 | void database_api_impl::on_objects_removed( const vector<const object*>& objs ) |
| 1444 | { |
| 1445 | /// we need to ensure the database_api is not deleted for the life of the async operation |
| 1446 | if( _subscribe_callback ) |
| 1447 | { |
| 1448 | vector<variant> updates; |
| 1449 | updates.reserve(objs.size()); |
| 1450 | |
| 1451 | for( auto obj : objs ) |
| 1452 | updates.emplace_back( obj->id ); |
| 1453 | broadcast_updates( updates ); |
| 1454 | } |
| 1455 | |
| 1456 | if( _market_subscriptions.size() ) |
| 1457 | { |
| 1458 | map< pair<asset_id_type, asset_id_type>, vector<variant> > broadcast_queue; |
| 1459 | for( const auto& obj : objs ) |
| 1460 | { |
| 1461 | const limit_order_object* order = dynamic_cast<const limit_order_object*>(obj); |
| 1462 | if( order ) |
| 1463 | { |
| 1464 | auto sub = _market_subscriptions.find( order->get_market() ); |
| 1465 | if( sub != _market_subscriptions.end() ) |
| 1466 | broadcast_queue[order->get_market()].emplace_back( order->id ); |
| 1467 | } |
| 1468 | } |
| 1469 | if( broadcast_queue.size() ) |
| 1470 | { |
| 1471 | auto capture_this = shared_from_this(); |
| 1472 | fc::async([capture_this,this,broadcast_queue](){ |
| 1473 | for( const auto& item : broadcast_queue ) |
| 1474 | { |
| 1475 | auto sub = _market_subscriptions.find(item.first); |
| 1476 | if( sub != _market_subscriptions.end() ) |
| 1477 | sub->second( fc::variant(item.second ) ); |
| 1478 | } |
| 1479 | }); |
| 1480 | } |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | void database_api_impl::on_objects_changed(const vector<object_id_type>& ids) |
| 1485 | { |
nothing calls this directly
no test coverage detected