Restore lost concurrency when scanning for triggers#3444
Conversation
| // Join on triggers and block hash resolution | ||
| let (triggers, to_hash) = futures03::join!(trigger_futs.try_concat(), to_hash_fut); | ||
|
|
||
| // Unpack and handle possible errors in the previously joined futures | ||
| let triggers = | ||
| triggers.with_context(|| format!("Failed to obtain triggers for block {}", to))?; | ||
| let to_hash = to_hash.with_context(|| format!("Failed to infer hash for block {}", to))?; |
There was a problem hiding this comment.
I decided not to use try_join! as it discards one error if the two operations fail.
There was a problem hiding this comment.
Well, this will discard the to_hash error if both fail, so it's not so different from try_join, which would be fine imo.
There was a problem hiding this comment.
You have a point.
I was reluctant to use try_join because it would only return the fastest error to resolve and discard the slowest, so I was concerned about indeterminism in this case.
If omitting a second error situation isn't a problem, I can change this to use try_join or just leave it as it is.
If not, I can rewrite this to provide a combined error message for when we have two error values.
Which one do you think would be preferable?
There was a problem hiding this comment.
interesting point about determinism. I think we can keep this as-is then.
This PR aims to improve performance issues introduced in #3373.
It reestablishes concurrency when scanning for triggers in a block range and resolving a block hash.