Skip to content

Commit db7d69d

Browse files
committed
adding cleanup method
1 parent 55ea7af commit db7d69d

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

EightBot.Orbit.Client/OrbitClient.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ public void Shutdown()
115115
}
116116
}
117117

118+
public Task CleanUp()
119+
{
120+
return _processingQueue
121+
.Queue (
122+
() =>
123+
{
124+
_db.Shrink ();
125+
});
126+
}
127+
118128
public OrbitClient AddTypeRegistration<T>(Func<T, Task> additionalProcessing = null, string typeNameOverride = null)
119129
where T : class
120130
{
@@ -722,20 +732,7 @@ public async Task Reconcile<T> (IEnumerable<ServerSyncInfo<T>> serverSyncInforma
722732
await UpsertCacheItems (inserts, category).ConfigureAwait (false);
723733
}
724734

725-
await _processingQueue
726-
.Queue (
727-
() =>
728-
{
729-
try
730-
{
731-
_db.Shrink ();
732-
}
733-
catch (InvalidOperationException)
734-
{
735-
// There is not much we can do here. Some platforms do not accept this configuration
736-
}
737-
})
738-
.ConfigureAwait (false);
735+
await CleanUp ().ConfigureAwait (false);
739736
}
740737

741738
private (bool IsDeleted, bool Exists) ItemExistsAndAvailable<T>(T obj, string category = null)

0 commit comments

Comments
 (0)