Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 79b13a7

Browse files
committed
Fix caching if quota isn't available
1 parent 19bddb4 commit 79b13a7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/cryptomator/cloudaccess/MetadataCachingProviderDecorator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.cryptomator.cloudaccess.api.ProgressListener;
1010
import org.cryptomator.cloudaccess.api.Quota;
1111
import org.cryptomator.cloudaccess.api.exceptions.NotFoundException;
12+
import org.cryptomator.cloudaccess.api.exceptions.QuotaNotAvailableException;
1213

1314
import java.io.InputStream;
1415
import java.time.Duration;
@@ -65,14 +66,14 @@ public CompletionStage<Quota> quota(CloudPath folder) {
6566
if (cachedMetadata != null) {
6667
return cachedMetadata //
6768
.map(CompletableFuture::completedFuture) //
68-
.orElseGet(() -> CompletableFuture.failedFuture(new NotFoundException()));
69+
.orElseGet(() -> CompletableFuture.failedFuture(new QuotaNotAvailableException()));
6970
} else {
7071
return delegate.quota(folder) //
7172
.whenComplete((quota, exception) -> {
7273
if (exception == null) {
7374
assert quota != null;
7475
quotaCache.put(folder, Optional.of(quota));
75-
} else if (exception instanceof NotFoundException) {
76+
} else if (exception instanceof NotFoundException || exception instanceof QuotaNotAvailableException) {
7677
quotaCache.put(folder, Optional.empty());
7778
} else {
7879
quotaCache.invalidate(folder);

0 commit comments

Comments
 (0)