1
0
Эх сурвалжийг харах

Fix cancellation order in CancellableRateLimitedFluxIterator (#104259)

Closes #103054
Francisco Fernández Castaño 1 жил өмнө
parent
commit
b7b3831fb9

+ 6 - 0
docs/changelog/104259.yaml

@@ -0,0 +1,6 @@
+pr: 104259
+summary: Fix cancellation order in `CancellableRateLimitedFluxIterator`
+area: Snapshot/Restore
+type: bug
+issues:
+ - 103054

+ 2 - 2
modules/repository-azure/src/main/java/org/elasticsearch/repositories/azure/CancellableRateLimitedFluxIterator.java

@@ -165,9 +165,9 @@ class CancellableRateLimitedFluxIterator<T> implements Subscriber<T>, Iterator<T
     }
 
     public void cancel() {
+        done = true;
         cancelSubscription();
         clearQueue();
-        done = true;
         // cancel should be called from the consumer
         // thread, but to avoid potential deadlocks
         // we just try to release a possibly blocked
@@ -177,9 +177,9 @@ class CancellableRateLimitedFluxIterator<T> implements Subscriber<T>, Iterator<T
 
     @Override
     public void onError(Throwable t) {
+        done = true;
         clearQueue();
         error = t;
-        done = true;
         signalConsumer();
     }