Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/DotJEM.Json.Index2.Management/Writer/IJsonIndexWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,16 @@ private void Commit()
if (callsRead < 1)
return;

using ILease<IndexWriter> lease = target.WriterLease;
try
{
using ILease<IndexWriter> lease = target.WriterLease;
lease.Value.Commit();
}
catch (Exception e)
{
target.infoStream.WriteError("Failed to commit indexed data to storage.", e);
bool leaseExpired = lease.IsExpired;

target.infoStream.WriteError($"Failed to commit indexed data to storage. {leaseExpired}", e);
// SWALLOW FOR NOW
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/DotJEM.Json.Index2/IO/JsonIndexWriterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public IndexWriter Value
}
}

public bool IsExpired => DateTime.Now - leaseTime > TimeSpan.FromSeconds(5);
public bool IsExpired => (DateTime.Now - leaseTime > TimeSpan.FromSeconds(5)) || IsDisposed;

public TimeLimitedIndexWriterLease(IndexWriterManager manager, Action<TimeLimitedIndexWriterLease> onReturned)
{
Expand All @@ -181,9 +181,6 @@ protected override void Dispose(bool disposing)

public void Wait()
{
if (IsDisposed)
return;

if (IsExpired)
return;

Expand Down
5 changes: 2 additions & 3 deletions src/DotJEM.Json.Index2/Storage/IJsonIndexStorageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ public Directory Directory
{
get
{
if (directory != null)
return directory;

lock (padlock)
{
if (directory != null)
Expand Down Expand Up @@ -83,6 +80,8 @@ public void Delete()
foreach (string file in directory.ListAll())
directory.DeleteFile(file);
provider.Delete();


}
}
}