Skip to content

Commit 1f8c141

Browse files
committed
Remove outdated sample from readme
1 parent f43fd9e commit 1f8c141

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

README.md

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -67,53 +67,3 @@ let sub = my_client.subscribe("subscription-name")
6767

6868
When subscribing to a topic, a random subscription name will be generated. To prevent dangling
6969
subscriptions, you need to explicitly call `subscription.destroy()`.
70-
71-
```
72-
let topic = Arc::new(pubsub.topic("update-topic".to_owned()));
73-
tokio::run(lazy(move || {
74-
topic
75-
.subscribe()
76-
.map(|subscription| {
77-
println!("Subscribed to topic with: {}", subscription.name);
78-
let sub = Arc::new(subscription);
79-
let get = sub
80-
.clone()
81-
.get_messages::<UpdatePacket>()
82-
.map(move |(packets, acks)| {
83-
for packet in packets {
84-
println!("Received: {:?}", packet);
85-
}
86-
87-
if !acks.is_empty() {
88-
tokio::spawn(sub.acknowledge_messages(acks));
89-
} else {
90-
println!("Cleaning up");
91-
if let Ok(s) = Arc::try_unwrap(sub) {
92-
let destroy = s
93-
.destroy()
94-
.map(|_r| println!("Successfully deleted subscription"))
95-
.map_err(|e| eprintln!("Failed deleting subscription: {}", e))
96-
.then(move |_| {
97-
drop(pubsub);
98-
Ok(())
99-
});
100-
tokio::spawn(destroy);
101-
} else {
102-
eprintln!("Subscription is still owned");
103-
}
104-
}
105-
})
106-
.map_err(|e| println!("Error Checking PubSub: {}", e));
107-
tokio::spawn(get);
108-
})
109-
.map_err(|e| eprintln!("Failed to subscribe: {}", e))
110-
}));
111-
```
112-
113-
## Known Caveats
114-
115-
A Hyper Client is retained by each PubSub client for reuse. This can cause the tokio runtime to not exit until the Hyper Client keep-alive terminates. To shutdown the runtime immediately on complete, the PubSub client needs to be explicitly dropped.
116-
117-
```
118-
drop(my_client);
119-
```

0 commit comments

Comments
 (0)