Skip to content

Commit

Permalink
Avoid unnecessary async-await in WebRequest.PerformAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Mar 6, 2021
1 parent 7f5f186 commit d625f65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion osu.Framework.Tests/Visual/Sprites/TestVideo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.IO;
using System.Threading;
using System.Threading.Tasks;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Video;
using osu.Framework.IO.Network;
Expand All @@ -14,7 +15,7 @@ internal class TestVideo : Video
private static MemoryStream consumeVideoStream()
{
var wr = new WebRequest("https://assets.ppy.sh/media/landing.mp4");
wr.PerformAsync();
Task.Run(() => wr.PerformAsync());

while (!wr.Completed)
Thread.Sleep(100);
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework/IO/Network/WebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public byte[] GetResponseData()
/// <summary>
/// Performs the request asynchronously.
/// </summary>
public async Task PerformAsync() => await PerformAsync(default);
public Task PerformAsync() => PerformAsync(default);

/// <summary>
/// Performs the request asynchronously.
Expand Down

0 comments on commit d625f65

Please sign in to comment.