Skip to content

Commit e3be0ca

Browse files
committed
Disable journaling while filling data
1 parent 4444083 commit e3be0ca

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

DevProxy.Abstractions/Data/MSGraphDb.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ public async Task<int> GenerateDbAsync(bool skipIfUpdatedToday, CancellationToke
6565
}
6666

6767
await CreateDbAsync(cancellationToken);
68+
69+
SetDbJournaling(false);
6870
await FillDataAsync(cancellationToken);
71+
SetDbJournaling(true);
72+
6973

7074
_logger.LogInformation("Microsoft Graph database successfully updated");
7175

@@ -214,6 +218,21 @@ private async Task LoadOpenAPIFilesAsync(string folder, CancellationToken cancel
214218
}
215219
}
216220

221+
private void SetDbJournaling(bool enabled)
222+
{
223+
using var command = Connection.CreateCommand();
224+
if (enabled)
225+
{
226+
command.CommandText = "PRAGMA journal_mode = DELETE;";
227+
_ = command.ExecuteNonQuery();
228+
}
229+
else
230+
{
231+
command.CommandText = "PRAGMA journal_mode = OFF;";
232+
_ = command.ExecuteNonQuery();
233+
}
234+
}
235+
217236
public void Dispose()
218237
{
219238
_connection?.Dispose();

0 commit comments

Comments
 (0)