⚡ Optimize bulk insert on conflict options
This commit is contained in:
parent
288d66221a
commit
95b3ab6bcd
@ -62,7 +62,7 @@ public class AccountService(
|
|||||||
if (missingId.Count != 0)
|
if (missingId.Count != 0)
|
||||||
{
|
{
|
||||||
var newProfiles = missingId.Select(id => new Profile { AccountId = id }).ToList();
|
var newProfiles = missingId.Select(id => new Profile { AccountId = id }).ToList();
|
||||||
await db.BulkInsertAsync(newProfiles);
|
await db.BulkInsertAsync(newProfiles, config => config.ConflictOption = ConflictOption.Ignore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ public class ActionLogFlushHandler(IServiceProvider serviceProvider) : IFlushHan
|
|||||||
using var scope = serviceProvider.CreateScope();
|
using var scope = serviceProvider.CreateScope();
|
||||||
var db = scope.ServiceProvider.GetRequiredService<AppDatabase>();
|
var db = scope.ServiceProvider.GetRequiredService<AppDatabase>();
|
||||||
|
|
||||||
await db.BulkInsertAsync(items);
|
await db.BulkInsertAsync(items, config => config.ConflictOption = ConflictOption.Ignore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user