diff --git a/MyApp.ServiceInterface/AiServerServices.cs b/MyApp.ServiceInterface/AiServerServices.cs index e7e5316..077cabb 100644 --- a/MyApp.ServiceInterface/AiServerServices.cs +++ b/MyApp.ServiceInterface/AiServerServices.cs @@ -17,7 +17,6 @@ public class AiServerServices(ILogger log, QuestionsProvider questions, RendererCache rendererCache, WorkerAnswerNotifier answerNotifier, - ICommandExecutor executor, IBackgroundJobs jobs) : Service { public async Task Any(CreateAnswersForModels request) diff --git a/MyApp.ServiceInterface/App/CreateFlagCommand.cs b/MyApp.ServiceInterface/App/CreateFlagCommand.cs deleted file mode 100644 index 9906869..0000000 --- a/MyApp.ServiceInterface/App/CreateFlagCommand.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Data; -using ServiceStack; -using ServiceStack.OrmLite; -using MyApp.ServiceModel; - -namespace MyApp.ServiceInterface.App; - -[Tag(Tags.Database)] -[Worker(Databases.App)] -public class CreateFlagCommand(IDbConnection db) : SyncCommand -{ - protected override void Run(Flag request) => db.Insert(request); -} diff --git a/MyApp.ServiceInterface/UserServices.cs b/MyApp.ServiceInterface/UserServices.cs index 6ac51b8..439120a 100644 --- a/MyApp.ServiceInterface/UserServices.cs +++ b/MyApp.ServiceInterface/UserServices.cs @@ -324,15 +324,19 @@ public async Task Any(FlagContent request) return HttpError.NotFound("Does not exist"); var userName = Request.GetClaimsPrincipal().GetUserName(); - jobs.RunCommand(new Flag { - PostId = postId, - RefId = request.RefId, - UserName = userName, - Type = request.Type, - Reason = request.Reason, - RemoteIp = Request?.RemoteIp, - CreatedDate = DateTime.UtcNow, - }); + lock (Locks.AppDb) + { + Db.Insert(new Flag + { + PostId = postId, + RefId = request.RefId, + UserName = userName, + Type = request.Type, + Reason = request.Reason, + RemoteIp = Request?.RemoteIp, + CreatedDate = DateTime.UtcNow, + }); + } return new FlagContent(); } }