Skip to content

Commit

Permalink
store: Remove use of uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
lutter committed Mar 7, 2025
1 parent 0e420a7 commit 8f9afd4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion 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 store/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ postgres-openssl = "0.5.0"
rand = "0.8.4"
serde = { workspace = true }
serde_json = { workspace = true }
uuid = { version = "1.15.1", features = ["v4"] }
stable-hash_legacy = { git = "https://github.com/graphprotocol/stable-hash", branch = "old", package = "stable-hash" }
anyhow = "1.0.86"
git-testament = "0.2.5"
Expand Down
6 changes: 3 additions & 3 deletions store/postgres/src/store_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use graph::tokio_stream::wrappers::ReceiverStream;
use std::sync::{atomic::Ordering, Arc, RwLock};
use std::{collections::HashMap, sync::atomic::AtomicUsize};
use tokio::sync::mpsc::{channel, Sender};
use uuid::Uuid;

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

/// Keep the notification listener alive
listener: StoreEventListener,
Expand Down Expand Up @@ -180,7 +179,8 @@ impl SubscriptionManager {

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

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

0 comments on commit 8f9afd4

Please sign in to comment.