|
26 | 26 | import io.sentry.transport.NoOpEnvelopeCache; |
27 | 27 | import io.sentry.util.AutoClosableReentrantLock; |
28 | 28 | import io.sentry.util.HintUtils; |
| 29 | +import io.sentry.util.LazyDirectory; |
29 | 30 | import io.sentry.util.Objects; |
30 | 31 | import java.io.BufferedInputStream; |
31 | 32 | import java.io.BufferedReader; |
@@ -83,15 +84,22 @@ public class EnvelopeCache extends CacheStrategy implements IEnvelopeCache { |
83 | 84 | options.getLogger().log(WARNING, "cacheDirPath is null, returning NoOpEnvelopeCache"); |
84 | 85 | return NoOpEnvelopeCache.getInstance(); |
85 | 86 | } else { |
86 | | - return new EnvelopeCache(options, cacheDirPath, maxCacheItems); |
| 87 | + return new EnvelopeCache(options, new LazyDirectory(cacheDirPath), maxCacheItems); |
87 | 88 | } |
88 | 89 | } |
89 | 90 |
|
90 | 91 | public EnvelopeCache( |
91 | 92 | final @NotNull SentryOptions options, |
92 | 93 | final @NotNull String cacheDirPath, |
93 | 94 | final int maxCacheItems) { |
94 | | - super(options, cacheDirPath, maxCacheItems); |
| 95 | + this(options, new LazyDirectory(cacheDirPath), maxCacheItems); |
| 96 | + } |
| 97 | + |
| 98 | + public EnvelopeCache( |
| 99 | + final @NotNull SentryOptions options, |
| 100 | + final @NotNull LazyDirectory directory, |
| 101 | + final int maxCacheItems) { |
| 102 | + super(options, directory, maxCacheItems); |
95 | 103 | previousSessionLatch = new CountDownLatch(1); |
96 | 104 | } |
97 | 105 |
|
|
0 commit comments