Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve runtime output stream order #927

Merged
merged 10 commits into from
Jan 21, 2021
Merged
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exe-unit/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ya-runtime-api"
version = "0.1.1"
version = "0.1.2"
authors = ["Golem Factory <contact@golem.network>"]
edition = "2018"

Expand Down
11 changes: 3 additions & 8 deletions exe-unit/runtime-api/src/server/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,9 @@ where
async move {
while let Some(event) = rx.next().await {
log::debug!("event: {:?}", event);
tokio::task::spawn_local({
let output = output.clone();
async move {
let mut output = output.lock().await;
let r = SinkExt::send(&mut *output, event).await;
log::debug!("sending event done: {:?}", r);
}
});
let mut output = output.lock().await;
let r = SinkExt::send(&mut *output, event).await;
log::debug!("sending event done: {:?}", r);
}
}
});
Expand Down
5 changes: 3 additions & 2 deletions service-bus/bus/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ where
Err(Error::GsbFailure(String::from_utf8(chunk.into_bytes())?))
}
};
let _ = ctx.spawn(
let _ = ctx.wait(
async move {
let s = r.send(item);
s.await
Expand Down Expand Up @@ -401,7 +401,8 @@ where
{
type Context = Context<Self>;

fn started(&mut self, _ctx: &mut Self::Context) {
fn started(&mut self, ctx: &mut Self::Context) {
ctx.set_mailbox_capacity(256);
log::info!("started connection to gsb");
}

Expand Down