1
0
mirror of https://github.com/bitwarden/server.git synced 2025-03-11 13:19:40 +01:00

adjusted transactions to prevent long locks

This commit is contained in:
Kyle Spearrin 2017-01-17 00:32:51 -05:00
parent 4c56a370a0
commit 143b4cb5ff

View File

@ -6,10 +6,10 @@ BEGIN
SET NOCOUNT ON SET NOCOUNT ON
DECLARE @BatchSize INT = 100 DECLARE @BatchSize INT = 100
BEGIN TRANSACTION User_DeleteById
WHILE @BatchSize > 0 WHILE @BatchSize > 0
BEGIN BEGIN
BEGIN TRANSACTION User_DeleteById_Ciphers
DELETE TOP(@BatchSize) DELETE TOP(@BatchSize)
FROM FROM
[dbo].[Cipher] [dbo].[Cipher]
@ -18,8 +18,12 @@ BEGIN
AND [Type] > 0 AND [Type] > 0
SET @BatchSize = @@ROWCOUNT SET @BatchSize = @@ROWCOUNT
COMMIT TRANSACTION User_DeleteById_Ciphers
END END
BEGIN TRANSACTION User_DeleteById
DELETE DELETE
FROM FROM
[dbo].[Cipher] [dbo].[Cipher]