Skip to content

Commit

Permalink
Replace AnswerAddedToPostCommand with lock
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Aug 20, 2024
1 parent 307e82c commit 7070c15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
19 changes: 0 additions & 19 deletions MyApp.ServiceInterface/App/AnswerAddedToPostCommand.cs

This file was deleted.

8 changes: 7 additions & 1 deletion MyApp.ServiceInterface/QuestionServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,13 @@ public async Task<object> Any(AnswerQuestion request)
};

jobs.RunCommand<CreateAnswerCommand>(answer);
jobs.RunCommand<AnswerAddedToPostCommand>(new AnswerAddedToPost { Id = postId });

lock (Locks.AppDb)
{
Db.UpdateAdd(() => new Post {
AnswerCount = 1,
}, x => x.Id == postId);
}

rendererCache.DeleteCachedQuestionPostHtml(postId);

Expand Down

0 comments on commit 7070c15

Please sign in to comment.