Skip to content

Commit

Permalink
Migrate away from deprecated purge_subject
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervonb committed Dec 19, 2022
1 parent e14ab3e commit 987407d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions async-nats/src/jetstream/object_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl ObjectStore {

let chunk_subject = format!("$O.{}.C.{}", self.name, object_info.nuid);

self.stream.purge_subject(&chunk_subject).await?;
self.stream.purge().filter(&chunk_subject).await?;

Ok(())
}
Expand Down Expand Up @@ -313,7 +313,7 @@ impl ObjectStore {
if let Some(existing_object_info) = maybe_existing_object_info {
let chunk_subject = format!("$O.{}.C.{}", &self.name, &existing_object_info.nuid);

self.stream.purge_subject(&chunk_subject).await?;
self.stream.purge().filter(&chunk_subject).await?;
}

Ok(object_info)
Expand Down
4 changes: 2 additions & 2 deletions async-nats/tests/jetstream_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ mod jetstream {
}

#[tokio::test]
async fn purge_stream_subject() {
async fn purge_filter() {
let server = nats_server::run_server("tests/configs/jetstream.conf");
let client = async_nats::connect(server.client_url()).await.unwrap();
let context = async_nats::jetstream::new(client);
Expand Down Expand Up @@ -466,7 +466,7 @@ mod jetstream {
let mut stream = context.get_stream("events").await.unwrap();
assert_eq!(stream.cached_info().state.messages, 7);

stream.purge_subject("events.two").await.unwrap();
stream.purge().filter("events.two").await.unwrap();

assert_eq!(stream.info().await.unwrap().state.messages, 3);
}
Expand Down

0 comments on commit 987407d

Please sign in to comment.