sync: use synchronous locks instead of semaphores

This commit is contained in:
Abdullah Atta
2025-08-01 10:52:48 +05:00
parent 76af2cbfc8
commit a96b0e1e42
4 changed files with 89 additions and 99 deletions

View File

@@ -43,8 +43,8 @@ namespace Notesnook.API.Controllers
{
try
{
var userId = this.User.FindFirstValue("sub");
new SyncDeviceService(new SyncDevice(ref userId, ref deviceId)).RegisterDevice();
var userId = this.User.FindFirstValue("sub") ?? throw new Exception("User not found.");
new SyncDeviceService(new SyncDevice(userId, deviceId)).RegisterDevice();
return Ok();
}
catch (Exception ex)
@@ -60,8 +60,8 @@ namespace Notesnook.API.Controllers
{
try
{
var userId = this.User.FindFirstValue("sub");
new SyncDeviceService(new SyncDevice(ref userId, ref deviceId)).UnregisterDevice();
var userId = this.User.FindFirstValue("sub") ?? throw new Exception("User not found.");
new SyncDeviceService(new SyncDevice(userId, deviceId)).UnregisterDevice();
return Ok();
}
catch (Exception ex)