Skip to content

Commit

Permalink
fix(indexer): Fixes inability to serialize Connection because of Arc.
Browse files Browse the repository at this point in the history
  • Loading branch information
humb1t committed Jan 22, 2025
1 parent 996d28f commit 5431d75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions applications/tari_indexer/src/json_rpc/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::{collections::HashMap, fmt::Display, sync::Arc};
use std::{collections::HashMap, fmt::Display, ops::Deref, sync::Arc};

use axum_jrpc::{
error::{JsonRpcError, JsonRpcErrorReason},
Expand Down Expand Up @@ -252,7 +252,7 @@ impl JsonRpcHandlers {
},
age: conn.age(),
ping_latency: conn.ping_latency,
user_agent: conn.user_agent,
user_agent: conn.user_agent.map(|arc| arc.deref().clone()),
})
.collect();

Expand Down
4 changes: 2 additions & 2 deletions clients/tari_indexer_client/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 The Tari Project
// SPDX-License-Identifier: BSD-3-Clause

use std::{sync::Arc, time::Duration};
use std::time::Duration;

use multiaddr::Multiaddr;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -457,7 +457,7 @@ pub struct Connection {
pub age: Duration,
#[cfg_attr(feature = "ts", ts(type = "{secs: number, nanos: number} | null"))]
pub ping_latency: Option<Duration>,
pub user_agent: Option<Arc<String>>,
pub user_agent: Option<String>,
}

#[derive(Serialize, Debug)]
Expand Down

0 comments on commit 5431d75

Please sign in to comment.