Skip to content

Commit 6c76a07

Browse files
jmdjmd
jmd
authored and
jmd
committedMar 7, 2024·
don't call delete on storage multiple times in cases where we have snapshots, (restoring a snapshot will delete the index files)
1 parent 2ab7f7e commit 6c76a07

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/DotJEM.Json.Index2.Management/IJsonIndexManager.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,15 @@ public JsonIndexManager(
7373

7474
public async Task RunAsync()
7575
{
76-
index.Storage.Delete();
7776
bool restoredFromSnapshot = await RestoreSnapshotAsync().ConfigureAwait(false);
78-
infoStream.WriteInfo($"Index restored from a snapshot: {restoredFromSnapshot}.");
77+
if (!restoredFromSnapshot)
78+
{
79+
index.Storage.Delete();
80+
}
81+
else
82+
{
83+
infoStream.WriteInfo($"Index was restored from snapshot.");
84+
}
7985

8086
await Task
8187
.WhenAll(

0 commit comments

Comments
 (0)
Please sign in to comment.