sync: improve perf of user account reset & deletion

this adds a new UserId index in all the notesnook collections which
helps to speed up the deletion time during account reset & delete.
This fixes the request timeout issues during both of these processes.
This commit is contained in:
Abdullah Atta
2023-01-16 13:22:57 +05:00
parent 9dc0c99e77
commit 443b4ab715
3 changed files with 15 additions and 8 deletions

View File

@@ -100,17 +100,18 @@ namespace Notesnook.API.Controllers
{
var userId = this.User.FindFirstValue("sub");
Response response = await this.httpClient.ForwardAsync<Response>(this.HttpContextAccessor, $"{Servers.IdentityServer.ToString()}/account/unregister", HttpMethod.Post);
if (!response.Success) return BadRequest();
if (await UserService.DeleteUserAsync(userId, User.FindFirstValue("jti")))
return Ok();
{
Response response = await this.httpClient.ForwardAsync<Response>(this.HttpContextAccessor, $"{Servers.IdentityServer.ToString()}/account/unregister", HttpMethod.Post);
if (!response.Success) return BadRequest();
return Ok();
}
return BadRequest();
}
catch
catch (Exception ex)
{
return BadRequest();
return BadRequest(ex.Message);
}
}
}