mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-08-07 09:01:25 -04:00
Critical Progress Order Fix (#2477)
This commit is contained in:
parent
36aa5c5a70
commit
980a123df3
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using API.Data.ManualMigrations;
|
using API.Data.ManualMigrations;
|
||||||
using API.DTOs;
|
using API.DTOs;
|
||||||
@ -218,15 +219,16 @@ public class AppUserProgressRepository : IAppUserProgressRepository
|
|||||||
})
|
})
|
||||||
.AsEnumerable();
|
.AsEnumerable();
|
||||||
|
|
||||||
|
// Need to run this Raw because DataContext will update LastModified on the entity which breaks ordering for progress
|
||||||
|
var sqlBuilder = new StringBuilder();
|
||||||
foreach (var update in updates)
|
foreach (var update in updates)
|
||||||
{
|
{
|
||||||
_context.AppUserProgresses
|
sqlBuilder.Append($"UPDATE AppUserProgresses SET PagesRead = {update.NewPagesRead} WHERE Id = {update.ProgressId};");
|
||||||
.Where(p => p.Id == update.ProgressId)
|
|
||||||
.ToList() // Execute the query to ensure exclusive lock
|
|
||||||
.ForEach(p => p.PagesRead = update.NewPagesRead);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
// Execute the batch SQL
|
||||||
|
var batchSql = sqlBuilder.ToString();
|
||||||
|
await _context.Database.ExecuteSqlRawAsync(batchSql);
|
||||||
}
|
}
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"name": "GPL-3.0",
|
"name": "GPL-3.0",
|
||||||
"url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"
|
"url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"
|
||||||
},
|
},
|
||||||
"version": "0.7.10.20"
|
"version": "0.7.11.0"
|
||||||
},
|
},
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user