Skip to content

Commit 8a93b49

Browse files
committed
store: Remove use of uuid
1 parent 7f6aad7 commit 8a93b49

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

store/postgres/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ postgres-openssl = "0.5.0"
2626
rand = "0.8.4"
2727
serde = { workspace = true }
2828
serde_json = { workspace = true }
29-
uuid = { version = "1.9.1", features = ["v4"] }
3029
stable-hash_legacy = { git = "https://github.com/graphprotocol/stable-hash", branch = "old", package = "stable-hash" }
3130
anyhow = "1.0.86"
3231
git-testament = "0.2.5"

store/postgres/src/store_events.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use graph::tokio_stream::wrappers::ReceiverStream;
66
use std::sync::{atomic::Ordering, Arc, RwLock};
77
use std::{collections::HashMap, sync::atomic::AtomicUsize};
88
use tokio::sync::mpsc::{channel, Sender};
9-
use uuid::Uuid;
109

1110
use crate::notification_listener::{NotificationListener, SafeChannelName};
1211
use graph::components::store::SubscriptionManager as SubscriptionManagerTrait;
@@ -89,7 +88,7 @@ impl StoreEventListener {
8988
/// Manage subscriptions to the `StoreEvent` stream. Keep a list of
9089
/// currently active subscribers and forward new events to each of them
9190
pub struct SubscriptionManager {
92-
subscriptions: Arc<RwLock<HashMap<String, Sender<Arc<StoreEvent>>>>>,
91+
subscriptions: Arc<RwLock<HashMap<usize, Sender<Arc<StoreEvent>>>>>,
9392

9493
/// Keep the notification listener alive
9594
listener: StoreEventListener,
@@ -180,7 +179,8 @@ impl SubscriptionManager {
180179

181180
impl SubscriptionManagerTrait for SubscriptionManager {
182181
fn subscribe(&self) -> StoreEventStreamBox {
183-
let id = Uuid::new_v4().to_string();
182+
static SUBSCRIPTION_COUNTER: AtomicUsize = AtomicUsize::new(0);
183+
let id = SUBSCRIPTION_COUNTER.fetch_add(1, Ordering::SeqCst);
184184

185185
// Prepare the new subscription by creating a channel and a subscription object
186186
let (sender, receiver) = channel(100);

0 commit comments

Comments
 (0)