Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
std::move strings to avoid copy
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Apr 30, 2021
1 parent bc9a94f commit c9f500e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/amqp_trx_plugin/amqp_trx_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ struct amqp_trx_plugin_impl : std::enable_shared_from_this<amqp_trx_plugin_impl>

trx_queue_ptr->push( trx,
[my=shared_from_this(), token=trx_trace.get_token(), delivery_tag, reply_to, correlation_id, trx]
(const std::variant<fc::exception_ptr, chain::transaction_trace_ptr>& result) {
(const std::variant<fc::exception_ptr, chain::transaction_trace_ptr>& result) mutable {
auto trx_span = fc_create_span_from_token(token, "Processed");
fc_add_tag(trx_span, "trx_id", trx->id());

// publish to trace plugin as exceptions are not reported via controller signal applied_transaction
if( std::holds_alternative<chain::exception_ptr>(result) ) {
auto& eptr = std::get<chain::exception_ptr>(result);
if( !reply_to.empty() ) {
my->trace_plug.publish_error( reply_to, correlation_id, eptr->code(), eptr->to_string() );
my->trace_plug.publish_error( std::move(reply_to), std::move(correlation_id), eptr->code(), eptr->to_string() );
}
fc_add_tag(trx_span, "error", eptr->to_string());
dlog( "accept_transaction ${id} exception: ${e}", ("id", trx->id())("e", eptr->to_string()) );
Expand All @@ -152,7 +152,7 @@ struct amqp_trx_plugin_impl : std::enable_shared_from_this<amqp_trx_plugin_impl>
} else {
auto& trace = std::get<chain::transaction_trace_ptr>(result);
if( !reply_to.empty() ) {
my->trace_plug.publish_result( reply_to, correlation_id, trx, trace );
my->trace_plug.publish_result( std::move(reply_to), std::move(correlation_id), trx, trace );
}
fc_add_tag(trx_span, "block_num", trace->block_num);
fc_add_tag(trx_span, "block_time", trace->block_time.to_time_point());
Expand Down

0 comments on commit c9f500e

Please sign in to comment.