Skip to content

Commit

Permalink
Don't create a Task if we don't have to.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejball committed Jul 11, 2016
1 parent 8ff77da commit f94a36e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/MySqlConnector/MySqlClient/MySqlConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ internal Task<T> AdaptTask<T>(Task<T> task)

internal ValueTask<T> AdaptTask<T>(ValueTask<T> task)
{
if (!Synchronous)
if (!Synchronous || task.IsCompletedSuccessfully)
return task;

return new ValueTask<T>(task.AsTask().GetAwaiter().GetResult());
Expand Down

0 comments on commit f94a36e

Please sign in to comment.