Skip to content

Commit f83dd8e

Browse files
authored
Fix cancellation order in CancellableRateLimitedFluxIterator (#104259) (#104263)
Closes #103054
1 parent 9923a87 commit f83dd8e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

docs/changelog/104259.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 104259
2+
summary: Fix cancellation order in `CancellableRateLimitedFluxIterator`
3+
area: Snapshot/Restore
4+
type: bug
5+
issues:
6+
- 103054

plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/CancellableRateLimitedFluxIterator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ public void onNext(T element) {
166166
}
167167

168168
public void cancel() {
169+
done = true;
169170
cancelSubscription();
170171
clearQueue();
171-
done = true;
172172
// cancel should be called from the consumer
173173
// thread, but to avoid potential deadlocks
174174
// we just try to release a possibly blocked
@@ -178,9 +178,9 @@ public void cancel() {
178178

179179
@Override
180180
public void onError(Throwable t) {
181+
done = true;
181182
clearQueue();
182183
error = t;
183-
done = true;
184184
signalConsumer();
185185
}
186186

0 commit comments

Comments
 (0)