Skip to content

Commit

Permalink
Calls clearData() on all data propagation providers.
Browse files Browse the repository at this point in the history
Signed-off-by: Santiago Pericasgeertsen <[email protected]>
  • Loading branch information
spericas committed Feb 2, 2024
1 parent 6996630 commit 2a97af4
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,12 @@ private Single<WebClientResponse> invoke(Flow.Publisher<DataChunk> requestEntity

@SuppressWarnings(value = "unchecked")
private void runInContext(Map<Class<?>, Object> data, Runnable command) {
PROPAGATION_PROVIDERS.forEach(provider -> provider.propagateData(data.get(provider.getClass())));
Contexts.runInContext(context, command);
try{
PROPAGATION_PROVIDERS.forEach(provider -> provider.propagateData(data.get(provider.getClass())));
Contexts.runInContext(context, command);
} finally{
PROPAGATION_PROVIDERS.forEach(provider -> provider.clearData(data.get(provider.getClass())));
}
}

/**
Expand All @@ -674,13 +678,17 @@ public void onNext(T item) {
}

@Override
@SuppressWarnings("unchecked")
public void onError(Throwable throwable) {
runInContext(contextProperties, () -> subscriber.onError(throwable));
PROPAGATION_PROVIDERS.forEach(provider -> provider.clearData(provider.getClass()));
}

@Override
@SuppressWarnings("unchecked")
public void onComplete() {
runInContext(contextProperties, subscriber::onComplete);
PROPAGATION_PROVIDERS.forEach(provider -> provider.clearData(provider.getClass()));
}
}));
}
Expand Down

0 comments on commit 2a97af4

Please sign in to comment.