-
Notifications
You must be signed in to change notification settings - Fork 37
Fix help thread refresh bug #1345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,8 @@ public partial class PuzzleThreadComponent : ComponentBase, IDisposable | |
|
|
||
| bool shouldRenderLocalTimes; | ||
|
|
||
| bool isMutationRunning; | ||
|
|
||
| ThreadMessageDTO LatestMessage => messages.FirstOrDefault(); | ||
|
|
||
| protected override async Task OnInitializedAsync() | ||
|
|
@@ -250,15 +252,26 @@ await RunMutationAsync(async () => | |
|
|
||
| async Task RunMutationAsync(Func<Task> mutation) | ||
| { | ||
| if (isMutationRunning) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this isMutationRunning code lacks a critical section or equivalent, it only works 100% of the time if it can be guaranteed to run in a single threaded environment. Do we have any assurance of that?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better to just wait for the previous mutation to complete and then perform the action? |
||
| { | ||
| errorMessage = "Please wait for the current action to finish."; | ||
| return; | ||
| } | ||
|
|
||
| try | ||
| { | ||
| isMutationRunning = true; | ||
| errorMessage = null; | ||
| await mutation(); | ||
|
Comment on lines
261
to
265
|
||
| } | ||
| catch (UserOperationException ex) | ||
| { | ||
| errorMessage = ex.Message; | ||
| } | ||
| finally | ||
| { | ||
| isMutationRunning = false; | ||
| } | ||
| } | ||
|
|
||
| void UpsertMessage(ThreadMessageDTO message) | ||
|
|
@@ -285,4 +298,5 @@ public void Dispose() | |
| MessageListener.OnThreadMessage -= OnThreadMessageReceived; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that the C# code is running on the server since it's part of ServerCore, so updating based on these bools would require a message back to the client. Is a mutation such a long-running operation that it's worth sending a message back to the client saying to wait?