Skip to content

Commit bacf0d2

Browse files
committed
*: Comment on calls
1 parent cf10430 commit bacf0d2

File tree

7 files changed

+14
-2
lines changed

7 files changed

+14
-2
lines changed

chain/ethereum/src/network_indexer/network_indexer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,8 @@ impl NetworkIndexer {
11741174
start_block,
11751175
});
11761176

1177-
// Launch state machine
1177+
// Launch state machine.
1178+
// Blocking due to store interactions. Won't be blocking after #905.
11781179
graph::spawn_blocking(
11791180
state_machine
11801181
.map_err(move |e| {

core/src/subgraph/instance_manager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ impl SubgraphInstanceManager {
236236
// Subgraph instance shutdown senders
237237
let instances: SharedInstanceKeepAliveMap = Default::default();
238238

239+
// Blocking due to store interactions. Won't be blocking after #905.
239240
graph::spawn_blocking(receiver.compat().try_for_each(move |event| {
240241
use self::SubgraphAssignmentProviderEvent::*;
241242

core/src/subgraph/registrar.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ where
111111

112112
// Deploy named subgraphs found in store
113113
self.start_assigned_subgraphs().and_then(move |()| {
114-
// Spawn a task to handle assignment events
114+
// Spawn a task to handle assignment events.
115+
// Blocking due to store interactions. Won't be blocking after #905.
115116
graph::spawn_blocking(
116117
assignment_event_stream
117118
.map_err(SubgraphAssignmentProviderError::Unknown)
@@ -255,6 +256,8 @@ where
255256
let sender = sender.clone();
256257
let provider = provider.clone();
257258
let logger = logger.clone();
259+
260+
// Blocking due to store interactions. Won't be blocking after #905.
258261
graph::spawn_blocking(
259262
start_subgraph(id, &*provider, logger)
260263
.map(move |()| drop(sender))

graph/src/task_spawn.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,19 @@ fn abort_on_panic<T: Send + 'static>(
1414
})
1515
}
1616

17+
/// Aborts on panic.
1718
pub fn spawn<T: Send + 'static>(f: impl Future03<Output = T> + Send + 'static) -> JoinHandle<T> {
1819
tokio::spawn(abort_on_panic(f))
1920
}
2021

22+
/// Aborts on panic.
2123
pub fn spawn_blocking<T: Send + 'static>(
2224
f: impl Future03<Output = T> + Send + 'static,
2325
) -> JoinHandle<T> {
2426
tokio::task::spawn_blocking(move || block_on(abort_on_panic(f)))
2527
}
2628

29+
/// Panics result in an `Err` in `JoinHandle`.
2730
pub fn spawn_blocking_allow_panic<T: Send + 'static>(
2831
f: impl Future03<Output = T> + Send + 'static,
2932
) -> JoinHandle<T> {

runtime/wasm/src/host_exports.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ fn test_string_to_h160_with_0x() {
680680
fn block_on<I: Send + 'static, ER: Send + 'static>(
681681
future: impl Future<Item = I, Error = ER> + Send + 'static,
682682
) -> Result<I, ER> {
683+
// We don't know if the task is blocking or not, but use `blocking` to be cautious.
683684
graph::spawn_blocking_allow_panic(future.compat())
684685
.compat()
685686
.wait()

server/json-rpc/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ where
214214
mpsc::channel::<Box<dyn std::future::Future<Output = ()> + Send + Unpin>>(100);
215215
graph::spawn(task_receiver.for_each(|f| {
216216
async {
217+
// Blocking due to store interactions. Won't be blocking after #905.
217218
graph::spawn_blocking(f);
218219
}
219220
}));

server/websocket/src/server.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ where
190190
ws_stream,
191191
graphql_runner.clone(),
192192
);
193+
194+
// Blocking due to store interactions. Won't be blocking after #905.
193195
graph::spawn_blocking_allow_panic(service.into_future().compat());
194196
}
195197
Err(e) => {

0 commit comments

Comments
 (0)