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
…#1253)

Description
---

Removes an Arc in Connection type.

Motivation and Context
---

With Arc type can't derive Serialize trait implementation.

How Has This Been Tested?
---

CI tests.

What process can a PR reviewer use to test or verify this change?
---


Breaking Changes
---

- [x] None
- [ ] Requires data directory to be deleted
- [ ] Other - Please specify
  • Loading branch information
humb1t authored Jan 23, 2025
1 parent 6c7e99a commit f9804c0
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 f9804c0

Please sign in to comment.