Skip to content

Commit

Permalink
replace dashmap with hashmap
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdul Basit committed Oct 4, 2023
1 parent 6f7d4c2 commit 3091f2a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
14 changes: 0 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion indexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ solana-program = "1.14"
anchor-lang = "0.26.0"
yellowstone-grpc-client = { git = "https://github.com/rpcpool/yellowstone-grpc", tag = "v1.7.1+solana.1.16.1" }
yellowstone-grpc-proto = { git = "https://github.com/rpcpool/yellowstone-grpc", tag = "v1.7.1+solana.1.16.1" }
dashmap = "5.4.0"
spl-token = "=3.5.0"
solana-client = "1.14"
backoff = { version = "0.4.0", features = ["tokio"] }
Expand Down
7 changes: 3 additions & 4 deletions indexer/src/handler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::sync::Arc;

use dashmap::DashMap;
use futures::{sink::SinkExt, stream::StreamExt};
use holaplex_hub_nfts_solana_core::{db::Connection, proto::SolanaNftEvents};
use hub_core::{
Expand Down Expand Up @@ -64,7 +63,7 @@ impl MessageHandler {
async fn connect(&self, request: SubscribeRequest) -> Result<()> {
(|| async {
let (mut subscribe_tx, mut stream) = self.connector.subscribe().await?;
let dashmap = DashMap::new();
let mut hashmap = std::collections::HashMap::new();
subscribe_tx
.send(request.clone())
.await
Expand All @@ -74,10 +73,10 @@ impl MessageHandler {
match message {
Ok(msg) => match msg.update_oneof {
Some(UpdateOneof::Transaction(tx)) => {
dashmap.entry(tx.slot).or_insert(Vec::new()).push(tx);
hashmap.entry(tx.slot).or_insert(Vec::new()).push(tx);
},
Some(UpdateOneof::Slot(slot)) => {
if let Some((_, transactions)) = dashmap.remove(&slot.slot) {
if let Some(transactions) = hashmap.remove(&slot.slot) {
for tx in transactions {
self.tx.send(tx)?;
}
Expand Down

0 comments on commit 3091f2a

Please sign in to comment.