From 90fedc6fa319f2a82eca34a538954ea31b274eeb Mon Sep 17 00:00:00 2001 From: Flaminel Date: Sat, 21 Mar 2026 21:48:27 +0200 Subject: [PATCH] added timeout to DataContext lock acquisition --- .../Features/Seeker/Controllers/SeekerConfigController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/backend/Cleanuparr.Api/Features/Seeker/Controllers/SeekerConfigController.cs b/code/backend/Cleanuparr.Api/Features/Seeker/Controllers/SeekerConfigController.cs index cbe4f423..2a34c33d 100644 --- a/code/backend/Cleanuparr.Api/Features/Seeker/Controllers/SeekerConfigController.cs +++ b/code/backend/Cleanuparr.Api/Features/Seeker/Controllers/SeekerConfigController.cs @@ -85,7 +85,11 @@ public sealed class SeekerConfigController : ControllerBase [HttpPut("seeker")] public async Task UpdateSeekerConfig([FromBody] UpdateSeekerConfigRequest request) { - await DataContext.Lock.WaitAsync(); + if (!await DataContext.Lock.WaitAsync(TimeSpan.FromSeconds(30))) + { + return StatusCode(503, "Database is busy, please try again"); + } + try { var config = await _dataContext.SeekerConfigs.FirstAsync();