mirror of
https://github.com/bitwarden/server.git
synced 2025-05-20 19:14:32 -05:00
throttle bulk procs to 50 ciphers at a time
This commit is contained in:
parent
967e383001
commit
ff39bb1dd5
@ -46,7 +46,9 @@ namespace Bit.Core.Repositories.DocumentDB
|
|||||||
var userId = ((Cipher)cleanedCiphers.First()).UserId;
|
var userId = ((Cipher)cleanedCiphers.First()).UserId;
|
||||||
StoredProcedureResponse<int> sprocResponse = await Client.ExecuteStoredProcedureAsync<int>(
|
StoredProcedureResponse<int> sprocResponse = await Client.ExecuteStoredProcedureAsync<int>(
|
||||||
ResolveSprocIdLink(userId, "updateDirtyCiphers"),
|
ResolveSprocIdLink(userId, "updateDirtyCiphers"),
|
||||||
cleanedCiphers,
|
// TODO: Figure out how to better determine the max number of document to send without
|
||||||
|
// going over 512kb limit for DocumentDB. 50 could still be too large in some cases.
|
||||||
|
cleanedCiphers.Take(50),
|
||||||
userId);
|
userId);
|
||||||
|
|
||||||
var replacedCount = sprocResponse.Response;
|
var replacedCount = sprocResponse.Response;
|
||||||
@ -71,7 +73,9 @@ namespace Bit.Core.Repositories.DocumentDB
|
|||||||
var userId = ((Cipher)cleanedCiphers.First()).UserId;
|
var userId = ((Cipher)cleanedCiphers.First()).UserId;
|
||||||
StoredProcedureResponse<int> sprocResponse = await Client.ExecuteStoredProcedureAsync<int>(
|
StoredProcedureResponse<int> sprocResponse = await Client.ExecuteStoredProcedureAsync<int>(
|
||||||
ResolveSprocIdLink(userId, "bulkCreate"),
|
ResolveSprocIdLink(userId, "bulkCreate"),
|
||||||
cleanedCiphers);
|
// TODO: Figure out how to better determine the max number of document to send without
|
||||||
|
// going over 512kb limit for DocumentDB. 50 could still be too large in some cases.
|
||||||
|
cleanedCiphers.Take(50));
|
||||||
|
|
||||||
var createdCount = sprocResponse.Response;
|
var createdCount = sprocResponse.Response;
|
||||||
if(createdCount != cleanedCiphers.Count())
|
if(createdCount != cleanedCiphers.Count())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user