diff options
| author | BaronGreenback <jimcartlidge@yahoo.co.uk> | 2020-12-15 01:15:54 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-15 01:15:54 +0000 |
| commit | 67c480ad53073a660e1485777cde6b2889780faf (patch) | |
| tree | 0662d81e0fdb1fd036fe7e207e406146b26b3dba /Jellyfin.Server.Implementations/Users/UserManager.cs | |
| parent | 0d4aa6bad61a8d7ef74b88a161913c5a64663937 (diff) | |
| parent | 4f6a585424ac8fc66d1f2d5a7fc71a9e85cd23de (diff) | |
Merge branch 'master' into PluginDowngrade
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Users/UserManager.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs index f684d151d..b76b272cf 100644 --- a/Jellyfin.Server.Implementations/Users/UserManager.cs +++ b/Jellyfin.Server.Implementations/Users/UserManager.cs @@ -1,5 +1,4 @@ -#nullable enable -#pragma warning disable CA1307 +#pragma warning disable CA1307 using System; using System.Collections.Concurrent; @@ -220,7 +219,7 @@ namespace Jellyfin.Server.Implementations.Users } /// <inheritdoc/> - public void DeleteUser(Guid userId) + public async Task DeleteUserAsync(Guid userId) { if (!_users.TryGetValue(userId, out var user)) { @@ -246,7 +245,7 @@ namespace Jellyfin.Server.Implementations.Users nameof(userId)); } - using var dbContext = _dbProvider.CreateContext(); + await using var dbContext = _dbProvider.CreateContext(); // Clear all entities related to the user from the database. if (user.ProfileImage != null) @@ -258,10 +257,10 @@ namespace Jellyfin.Server.Implementations.Users dbContext.RemoveRange(user.Preferences); dbContext.RemoveRange(user.AccessSchedules); dbContext.Users.Remove(user); - dbContext.SaveChanges(); + await dbContext.SaveChangesAsync().ConfigureAwait(false); _users.Remove(userId); - _eventManager.Publish(new UserDeletedEventArgs(user)); + await _eventManager.PublishAsync(new UserDeletedEventArgs(user)).ConfigureAwait(false); } /// <inheritdoc/> |
