yrashk / bpxe.rs

Business Process eXecution Engine
Apache License 2.0
36 stars 10 forks source link

Problem: using StreamFuture + FuturesUnordered in process scheduler #14

Closed yrashk closed 3 years ago

yrashk commented 3 years ago

First of all, it really obscures the intent. The idea there is pretty simple -- get items from all flow nodes (they are Streams). However, the amount of ceremony around futures/streams really obscurs this idea.

Secondly, the current approach has two dubious unwraps in Deref and DerefMut for scheduler::FlowNode. That's not great.

Lastly, but not least importantly, returning that Next structure involves a non-zero amount of allocation / copying, which isn't great either.

Solution: use StreamUnorderded to convey the intent and to optimize resources