Skip to content

Commit

Permalink
geyser: add name to tokio threads (rpcpool#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid authored Dec 23, 2023
1 parent bc235ed commit bc4ab2d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ["${{ matrix.os }}"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set rust version
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ["${{ matrix.os }}"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set rust version
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The minor version will be incremented upon a breaking change and the patch versi
### Features

- proto: add more convert functions ([#264](https://github.com/rpcpool/yellowstone-grpc/pull/264))
- geyser: add name to tokio threads ([#267](https://github.com/rpcpool/yellowstone-grpc/pull/267))

### Breaking

Expand Down
20 changes: 17 additions & 3 deletions yellowstone-grpc-geyser/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ use {
ReplicaEntryInfoVersions, ReplicaTransactionInfoVersions, Result as PluginResult,
SlotStatus,
},
std::{sync::Arc, time::Duration},
std::{
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
time::Duration,
},
tokio::{
runtime::Runtime,
runtime::{Builder, Runtime},
sync::{mpsc, Notify},
},
};
Expand Down Expand Up @@ -60,7 +66,15 @@ impl GeyserPlugin for Plugin {
solana_logger::setup_with_default(&config.log.level);

// Create inner
let runtime = Runtime::new().map_err(|error| GeyserPluginError::Custom(Box::new(error)))?;
let runtime = Builder::new_multi_thread()
.thread_name_fn(|| {
static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0);
let id = ATOMIC_ID.fetch_add(1, Ordering::Relaxed);
format!("solGeyserGrpc{id:02}")
})
.enable_all()
.build()
.map_err(|error| GeyserPluginError::Custom(Box::new(error)))?;

let (snapshot_channel, grpc_channel, grpc_shutdown, prometheus) =
runtime.block_on(async move {
Expand Down

0 comments on commit bc4ab2d

Please sign in to comment.