Skip to content

Commit

Permalink
fix bots
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Jan 4, 2022
1 parent 0570170 commit 5b08ef0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Playwright.Tests/CapabilitiesTests.cs
Expand Up @@ -45,6 +45,7 @@ public async Task WebAssemblyShouldWork()
[Skip(SkipAttribute.Targets.Webkit | SkipAttribute.Targets.Windows)]
public async Task WebSocketShouldWork()
{
Server.SendOnWebSocketConnection("incoming");
string value = await Page.EvaluateAsync<string>(
$@"(port) => {{
let cb;
Expand Down
11 changes: 10 additions & 1 deletion src/Playwright/Helpers/TaskQueue.cs
Expand Up @@ -31,24 +31,33 @@ namespace Microsoft.Playwright.Helpers
internal class TaskQueue : IDisposable
{
private readonly SemaphoreSlim _semaphore;
private bool _disposed;

internal TaskQueue() => _semaphore = new(1, 1);

public void Dispose()
{
_disposed = true;
_semaphore.Dispose();
}

internal async Task EnqueueAsync(Func<Task> taskGenerator)
{
if (_disposed)
{
return;
}
await _semaphore.WaitAsync().ConfigureAwait(false);
try
{
await taskGenerator().ConfigureAwait(false);
}
finally
{
_semaphore.Release();
if (!_disposed)
{
_semaphore.Release();
}
}
}
}
Expand Down

0 comments on commit 5b08ef0

Please sign in to comment.