Skip to content

Commit

Permalink
Save some work when BlobStoreCacheService is stopping (#81658) (#81717)
Browse files Browse the repository at this point in the history
There is no reason to build a document if we know the
`BlobStoreCacheService` is stopping. We can save a bit a work here.
  • Loading branch information
tlrx committed Dec 14, 2021
1 parent 0d40336 commit 7d03826
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ public final void putAsync(
final long timeInEpochMillis,
final ActionListener<Void> listener
) {
if (closed.get()) {
listener.onFailure(new IllegalStateException("Blob cache service is closed"));
return;
}
final String id = generateId(repository, snapshotId, indexId, shardId, name, range);
try {
final CachedBlob cachedBlob = new CachedBlob(
Expand All @@ -267,10 +271,6 @@ public final void putAsync(
boolean submitted = false;
inFlightCacheFills.acquire();
try {
if (closed.get()) {
listener.onFailure(new IllegalStateException("Blob cache service is closed"));
return;
}
final ActionListener<Void> wrappedListener = ActionListener.runAfter(listener, release);
innerPut(request, new ActionListener<IndexResponse>() {
@Override
Expand Down

0 comments on commit 7d03826

Please sign in to comment.