Skip to content

Commit

Permalink
Remove unnecessary spinwaits.
Browse files Browse the repository at this point in the history
Now we don't have an extra Thread to deal with, this is simpler.
  • Loading branch information
craigjbass committed Oct 30, 2019
1 parent 72d1199 commit 302011e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using FluentAssertions.Extensions;
using Frank.API.WebDevelopers.DTO;
using Frank.Plugins.HttpListener;

Expand Down Expand Up @@ -39,11 +37,7 @@ public void AssertHeadersCaseInsensitivelyContain(string expectedKey, string exp
expectedValue));
}

private Request FirstRequest()
{
WaitForRequest();
return _requests.First();
}
private Request FirstRequest() => _requests.First();

private static string CapitalizeFirstLetter(string expectedKey)
{
Expand Down Expand Up @@ -87,7 +81,6 @@ public void Start()
}

public string Host => "http://127.0.0.1:8020";
public void WaitForRequest() => SpinWait.SpinUntil(() => !_requests.IsEmpty, (int) 30.Seconds().TotalMilliseconds);

public void Stop()
{
Expand Down
2 changes: 0 additions & 2 deletions Frank/Internals/TestHarness.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Threading;
using Frank.API.PluginDevelopers;
using Frank.API.WebDevelopers;
using Frank.API.WebDevelopers.DTO;
Expand Down Expand Up @@ -56,7 +55,6 @@ public void RegisterRequestHandler(Action<Request, IResponseBuffer> processReque

public Response Execute(Request request)
{
SpinWait.SpinUntil(() => _processRequest != null);
request.Path = "/";
var buffer = new TestResponseBuffer();
_processRequest(request, buffer);
Expand Down
1 change: 0 additions & 1 deletion Frank/Internals/WebApplication.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Frank.API.PluginDevelopers;
using Frank.API.WebDevelopers;
using Frank.API.WebDevelopers.DTO;
Expand Down

0 comments on commit 302011e

Please sign in to comment.