mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
Wrapped the bulk insert inside a transaction
This commit is contained in:
parent
1fa32d29ea
commit
5471a77480
1 changed files with 14 additions and 2 deletions
|
@ -289,9 +289,21 @@ namespace PlexRequests.Store.Repository
|
|||
ResetCache();
|
||||
using (var db = Config.DbConnection())
|
||||
{
|
||||
var result = enumerable.Sum(e => db.Insert(e));
|
||||
db.Open();
|
||||
using (var tran = db.BeginTransaction())
|
||||
{
|
||||
var result = enumerable.Sum(e => db.Insert(e));
|
||||
var done = result == enumerable.Length;
|
||||
|
||||
return result == enumerable.Length;
|
||||
if (done)
|
||||
{
|
||||
tran.Commit();
|
||||
return true;
|
||||
}
|
||||
|
||||
tran.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue