From ba1884aacb313393ea6eb48c6700b2c4582da599 Mon Sep 17 00:00:00 2001 From: YishaiGalatzer Date: Tue, 7 Oct 2014 23:04:36 -0700 Subject: [PATCH] Make wait service not timeout without yelling, and making the timeout longer --- .../RazorWebSite/Services/WaitService.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/WebSites/RazorWebSite/Services/WaitService.cs b/test/WebSites/RazorWebSite/Services/WaitService.cs index 2a87a718b6..0505187b90 100644 --- a/test/WebSites/RazorWebSite/Services/WaitService.cs +++ b/test/WebSites/RazorWebSite/Services/WaitService.cs @@ -8,7 +8,7 @@ namespace RazorWebSite { public class WaitService { - private static readonly TimeSpan _waitTime = TimeSpan.FromSeconds(10); + private static readonly TimeSpan _waitTime = TimeSpan.FromSeconds(60); private readonly ManualResetEventSlim _serverResetEvent = new ManualResetEventSlim(); private readonly ManualResetEventSlim _clientResetEvent = new ManualResetEventSlim(); @@ -20,14 +20,24 @@ namespace RazorWebSite public void WaitForClient() { _clientResetEvent.Set(); - _serverResetEvent.Wait(_waitTime); + + if (!_serverResetEvent.Wait(_waitTime)) + { + throw new InvalidOperationException("Timeout exceeded"); + } + _serverResetEvent.Reset(); } public void WaitForServer() { _serverResetEvent.Set(); - _clientResetEvent.Wait(_waitTime); + + if (!_clientResetEvent.Wait(_waitTime)) + { + throw new InvalidOperationException("Timeout exceeded"); + } + _clientResetEvent.Reset(); } }