Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SIL.Harmony.Core/QueryHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class QueryHelpers
{
public static async Task<SyncState> GetSyncState(this IQueryable<CommitBase> commits)
{
var dict = await commits.GroupBy(c => c.ClientId)
var dict = await commits.AsNoTracking().GroupBy(c => c.ClientId)
.Select(g => new { ClientId = g.Key, DateTime = g.Max(c => c.HybridDateTime.DateTime) })
.AsAsyncEnumerable()//this is so the ticks are calculated server side instead of the db
.ToDictionaryAsync(c => c.ClientId, c => c.DateTime.ToUnixTimeMilliseconds());
Expand Down
2 changes: 1 addition & 1 deletion src/SIL.Harmony/Db/CrdtRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public IQueryable<T> GetCurrentObjects<T>() where T : class
{
if (_crdtConfig.Value.EnableProjectedTables)
{
return _dbContext.Set<T>();
return _dbContext.Set<T>().AsNoTracking();
}
throw new NotSupportedException("GetCurrentObjects is not supported when not using projected tables");
}
Expand Down