Skip to content

Commit

Permalink
Merge branch 'main' into better-consumer-impl
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobarbolini committed Sep 20, 2023
2 parents 3696182 + 98fd93a commit 8be423e
Show file tree
Hide file tree
Showing 21 changed files with 1,418 additions and 551 deletions.
2 changes: 2 additions & 0 deletions .config/nats.dic
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,5 @@ filter_subjects
rollup
IoT
ObjectMeta
128k
ObjectMetadata
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.19'
go-version: '1.20'

- name: Install nats-server
run: go install github.com/nats-io/nats-server/v2@${{ matrix.nats_server }}
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v2
with:
go-version: '1.19'
go-version: '1.20'

- name: Set up rust
run: |
Expand Down
15 changes: 12 additions & 3 deletions async-nats/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ categories = ["network-programming", "api-bindings"]
[dependencies]
memchr = "2.4"
bytes = { version = "1.4.0", features = ["serde"] }
futures = { version = "0.3.28", default-features = false, features = ["std", "async-await"] }
nkeys = "0.3.0"
futures = { version = "0.3.28", default-features = false, features = ["std"] }
nkeys = "0.3.1"
once_cell = "1.18.0"
regex = "1.9.1"
serde = { version = "1.0.184", features = ["derive"] }
serde_json = "1.0.104"
serde_repr = "0.1.16"
http = "0.2.9"
tokio = { version = "1.29.0", features = ["macros", "rt", "fs", "net", "sync", "time", "io-util"] }
itoa = "1"
url = { version = "2"}
tokio-rustls = "0.24"
rustls-pemfile = "1.0.2"
Expand All @@ -41,23 +40,33 @@ ring = "0.16"
rand = "0.8"
webpki = { package = "rustls-webpki", version = "0.101.2", features = ["alloc", "std"] }

# for -Z minimal-versions
rustls = "0.21.6" # used by tokio-rustls 0.24.0

[dev-dependencies]
criterion = { version = "0.5", features = ["async_tokio"]}
nats-server = { path = "../nats-server" }
rand = "0.8"
tokio = { version = "1.25.0", features = ["rt-multi-thread"] }
futures = { version = "0.3.28", default-features = false, features = ["std", "async-await"] }
tracing-subscriber = "0.3"
async-nats = {path = ".", features = ["experimental"]}
reqwest = "0.11.18"


[features]
service = []
experimental = ["service"]
"server_2_10" = []
slow_tests = []
compatibility_tests = []


[[bench]]
name = "main"
harness = false
lto = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
8 changes: 2 additions & 6 deletions async-nats/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,6 @@ impl Client {
}
None => self.publish_with_reply(subject, inbox, payload).await?,
}
self.flush()
.await
.map_err(|err| RequestError::with_source(RequestErrorKind::Other, err))?;
let request = match timeout {
Some(timeout) => {
tokio::time::timeout(timeout, sub.next())
Expand Down Expand Up @@ -517,12 +514,11 @@ impl Client {
pub async fn flush(&self) -> Result<(), FlushError> {
let (tx, rx) = tokio::sync::oneshot::channel();
self.sender
.send(Command::Flush { result: tx })
.send(Command::Flush { observer: tx })
.await
.map_err(|err| FlushError::with_source(FlushErrorKind::SendError, err))?;
// first question mark is an error from rx itself, second for error from flush.

rx.await
.map_err(|err| FlushError::with_source(FlushErrorKind::FlushError, err))?
.map_err(|err| FlushError::with_source(FlushErrorKind::FlushError, err))?;
Ok(())
}
Expand Down

0 comments on commit 8be423e

Please sign in to comment.