Skip to content

Commit 4a2f4c4

Browse files
committed
runtime/wasm: Remove use of uuid
1 parent 1342f34 commit 4a2f4c4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/wasm/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ graph = { path = "../../graph" }
1111
bs58 = "0.4.0"
1212
graph-runtime-derive = { path = "../derive" }
1313
semver = "1.0.23"
14-
uuid = { version = "1.15.1", features = ["v4"] }
1514
anyhow = "1.0"
1615
never = "0.1"
1716

runtime/wasm/src/mapping.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use graph::runtime::gas::Gas;
1212
use parity_wasm::elements::ExportEntry;
1313
use std::collections::BTreeMap;
1414
use std::panic::AssertUnwindSafe;
15+
use std::sync::atomic::{AtomicUsize, Ordering};
1516
use std::sync::Arc;
1617
use std::{panic, thread};
1718

@@ -28,6 +29,8 @@ pub fn spawn_module<C: Blockchain>(
2829
where
2930
<C as Blockchain>::MappingTrigger: ToAscPtr,
3031
{
32+
static THREAD_COUNT: AtomicUsize = AtomicUsize::new(0);
33+
3134
let valid_module = Arc::new(ValidModule::new(&logger, raw_module, timeout)?);
3235

3336
// Create channel for event handling requests
@@ -39,8 +42,8 @@ where
3942
// In case of failure, this thread may panic or simply terminate,
4043
// dropping the `mapping_request_receiver` which ultimately causes the
4144
// subgraph to fail the next time it tries to handle an event.
42-
let conf =
43-
thread::Builder::new().name(format!("mapping-{}-{}", &subgraph_id, uuid::Uuid::new_v4()));
45+
let next_id = THREAD_COUNT.fetch_add(1, Ordering::SeqCst);
46+
let conf = thread::Builder::new().name(format!("mapping-{}-{:0>4}", &subgraph_id, next_id));
4447
conf.spawn(move || {
4548
let _runtime_guard = runtime.enter();
4649

0 commit comments

Comments
 (0)