fix: async void -> async Task and fix TotalMilliseconds in Sleep log#149
Closed
manan164 wants to merge 1 commit into
Closed
fix: async void -> async Task and fix TotalMilliseconds in Sleep log#149manan164 wants to merge 1 commit into
manan164 wants to merge 1 commit into
Conversation
Bug 2: WorkOnce, ProcessTasks, and ProcessTask were declared as `private async void`, which swallows exceptions — they are fire-and-forget and callers cannot await them. Changed all three to `private async Task` so exceptions propagate correctly. Work4Ever now calls WorkOnce(...).GetAwaiter().GetResult() to stay synchronous at the top-level loop. Bug 3: The Sleep() log message used timeSpan.Milliseconds (the subsecond component, range 0-999) instead of timeSpan.TotalMilliseconds (the full duration as a double). Any sleep >= 1 second would log 0ms or an incorrect truncated value. Fixed to use TotalMilliseconds.
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Collaborator
Author
|
Closing — Agentspan uses TaskResourceApi directly rather than WorkflowTaskHost/WorkflowTaskExecutor, so the async void and TotalMilliseconds issues don't affect our usage. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problems Fixed
Bug 2:
async voidfire-and-forget in WorkflowTaskExecutorWorkOnce,ProcessTasks, andProcessTaskwere all declaredprivate async void. This means:Work4Evertry/catch loop.Fix: Changed all three to
private async Task.Work4Evernow callsWorkOnce(token).GetAwaiter().GetResult()to preserve the synchronous outer loop while surfacing exceptions correctly.Bug 3:
TimeSpan.MillisecondsvsTimeSpan.TotalMillisecondsin Sleep logThe
Sleep()helper loggedtimeSpan.Milliseconds, which is the sub-second milliseconds component (range 0-999). Any sleep of 1 second or more would log an incorrect/truncated value (e.g., a 1.5s sleep logs500ms, a 2s sleep logs0ms).Fix: Changed to
timeSpan.TotalMillisecondswhich returns the full duration as a double.Changes
Conductor/Client/Worker/WorkflowTaskExecutor.csWorkOnce:async void->async TaskProcessTasks:async void->async TaskProcessTask:async void->async TaskWork4Ever: awaitsWorkOncevia.GetAwaiter().GetResult()Sleep(): log usestimeSpan.TotalMillisecondsinstead oftimeSpan.Milliseconds