mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
Avoid sql connection timeout (#1409)
* Read known emails to memory so we can close connection. * Use ICollection as return * Fix null reference if ip and date aren't set
This commit is contained in:
parent
601bf5416d
commit
ee66d64c99
@ -15,7 +15,7 @@ namespace Bit.Core.Repositories
|
||||
Task<ICollection<OrganizationUser>> GetManyByUserAsync(Guid userId);
|
||||
Task<ICollection<OrganizationUser>> GetManyByOrganizationAsync(Guid organizationId, OrganizationUserType? type);
|
||||
Task<int> GetCountByOrganizationAsync(Guid organizationId, string email, bool onlyRegisteredUsers);
|
||||
Task<IEnumerable<string>> SelectKnownEmailsAsync(Guid organizationId, IEnumerable<string> emails, bool onlyRegisteredUsers);
|
||||
Task<ICollection<string>> SelectKnownEmailsAsync(Guid organizationId, IEnumerable<string> emails, bool onlyRegisteredUsers);
|
||||
Task<OrganizationUser> GetByOrganizationAsync(Guid organizationId, Guid userId);
|
||||
Task<Tuple<OrganizationUser, ICollection<SelectionReadOnly>>> GetByIdWithCollectionsAsync(Guid id);
|
||||
Task<OrganizationUserUserDetails> GetDetailsByIdAsync(Guid id);
|
||||
|
@ -164,9 +164,9 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
eventsTable.Columns.Add(actingUserIdColumn);
|
||||
var deviceTypeColumn = new DataColumn(nameof(e.DeviceType), typeof(int));
|
||||
eventsTable.Columns.Add(deviceTypeColumn);
|
||||
var ipAddressColumn = new DataColumn(nameof(e.IpAddress), e.IpAddress.GetType());
|
||||
var ipAddressColumn = new DataColumn(nameof(e.IpAddress), typeof(string));
|
||||
eventsTable.Columns.Add(ipAddressColumn);
|
||||
var dateColumn = new DataColumn(nameof(e.Date), e.Date.GetType());
|
||||
var dateColumn = new DataColumn(nameof(e.Date), typeof(DateTime));
|
||||
eventsTable.Columns.Add(dateColumn);
|
||||
|
||||
foreach (DataColumn col in eventsTable.Columns)
|
||||
|
@ -76,7 +76,7 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<string>> SelectKnownEmailsAsync(Guid organizationId, IEnumerable<string> emails,
|
||||
public async Task<ICollection<string>> SelectKnownEmailsAsync(Guid organizationId, IEnumerable<string> emails,
|
||||
bool onlyRegisteredUsers)
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
|
Loading…
Reference in New Issue
Block a user