docs:#306 trying to improve generating related sections performance
This commit is contained in:
parent
8ab1894d05
commit
642a69de25
@ -185,6 +185,9 @@ namespace RMuseum.DbContext
|
||||
builder.Entity<GanjoorPoemSection>()
|
||||
.HasIndex(v => new { v.GanjoorMetreId, v.RhymeLetters });
|
||||
|
||||
builder.Entity<GanjoorPoemSection>()
|
||||
.HasIndex(v => new { v.GanjoorMetreId, v.RhymeLetters, v.Id});
|
||||
|
||||
builder.Entity<GanjoorCachedRelatedSection>()
|
||||
.HasIndex(v => new { v.PoemId, v.SectionIndex });
|
||||
}
|
||||
|
||||
4098
RMuseum/Migrations/20220415133638_GanjoorPoemSectionIdIndex.Designer.cs
generated
Normal file
4098
RMuseum/Migrations/20220415133638_GanjoorPoemSectionIdIndex.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class GanjoorPoemSectionIdIndex : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorPoemSections_GanjoorMetreId_RhymeLetters_Id",
|
||||
table: "GanjoorPoemSections",
|
||||
columns: new[] { "GanjoorMetreId", "RhymeLetters", "Id" });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GanjoorPoemSections_GanjoorMetreId_RhymeLetters_Id",
|
||||
table: "GanjoorPoemSections");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1312,6 +1312,8 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasIndex("PoemId", "Index");
|
||||
|
||||
b.HasIndex("GanjoorMetreId", "RhymeLetters", "Id");
|
||||
|
||||
b.ToTable("GanjoorPoemSections");
|
||||
});
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ namespace RMuseum.Services.Implementation
|
||||
if (await context.GanjoorCachedRelatedSections.AnyAsync(r => r.PoemId == sections[i].PoemId && r.SectionIndex == sections[i].Index))
|
||||
continue;
|
||||
}
|
||||
if (i * 100 / sections.Count > percent)
|
||||
if (i * 10000 / sections.Count > percent)
|
||||
{
|
||||
percent++;
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, percent);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user