Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Feb 25, 2024
1 parent cec75ab commit d8bebe4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/BUTR.CrashReportServer/Services/DatabaseMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -49,6 +50,8 @@ protected override async Task ExecuteAsync(CancellationToken ct)
}).ToArrayAsync(ct);
await postgres.Set<IdEntity>().AddRangeAsync(data, ct);
await postgres.SaveChangesAsync(ct);
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
}

var fileDataCount = sqlite.FileEntities.AsNoTracking().Count();
Expand All @@ -64,6 +67,8 @@ protected override async Task ExecuteAsync(CancellationToken ct)
.ToArrayAsync(ct);
await postgres.FileEntities.AddRangeAsync(data, ct);
await postgres.SaveChangesAsync(ct);
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
}

var jsonDataCount = sqlite.JsonEntities.AsNoTracking().Count();
Expand All @@ -78,6 +83,8 @@ protected override async Task ExecuteAsync(CancellationToken ct)
}).ToArrayAsync(ct);
await postgres.JsonEntities.AddRangeAsync(data, ct);
await postgres.SaveChangesAsync(ct);
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
}
}
}

0 comments on commit d8bebe4

Please sign in to comment.