Skip to content

Commit

Permalink
wait for message to be sent
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot committed Nov 27, 2023
1 parent 6ee8d21 commit b147166
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ object AsyncNetworkApi {
s"it-client-to-${node.name}",
nonce
)
sender.connect(node.networkAddress).map { ch =>
if (ch.isActive) sender.send(ch, messages*).map(_ => sender.close()) else sender.close()
sender.connect(node.networkAddress).flatMap { ch =>
if (ch.isActive) sender.send(ch, messages*).map(_ => sender.close()) else {
sender.close()
Future.failed(new Exception("Channel is inactive"))
}
}
}
}
Expand Down

0 comments on commit b147166

Please sign in to comment.