just now it passed. I have changed nothing. it took 4 seconds.

This commit is contained in:
Adam R. Grey 2021-06-19 05:39:39 -04:00
parent c3fdf8fb9b
commit 634713171d
3 changed files with 14 additions and 25 deletions

View File

@ -19,7 +19,7 @@ namespace franz.tests
} }
[Test] [Test]
public void reportsToSoundoff() public async Task reportsToSoundoff()
{ {
var f1Reported = false; var f1Reported = false;
var f2Reported = false; var f2Reported = false;
@ -42,6 +42,7 @@ namespace franz.tests
}); });
f1.StartListening(); f1.StartListening();
f2.StartListening(); f2.StartListening();
await Task.Delay(2000);
f1.ProduceMessage(new silver_messages.global.sound_off()); f1.ProduceMessage(new silver_messages.global.sound_off());
Task.WaitAny( Task.WaitAny(
Task.Run(async () => { Task.Run(async () => {
@ -53,7 +54,7 @@ namespace franz.tests
//TestContext.Out.WriteLine("done, ready, green"); //TestContext.Out.WriteLine("done, ready, green");
}), }),
Task.Run(async () => { Task.Run(async () => {
await Task.Delay(10000); await Task.Delay(120000);
TestContext.Out.WriteLine("time up"); TestContext.Out.WriteLine("time up");
Assert.Fail(); Assert.Fail();
}) })

View File

@ -122,13 +122,11 @@ namespace franz
{ {
StopListening(); StopListening();
listenTask = Task.Run(() => listenTask = Task.Run(() =>
{
try
{ {
shouldListen = true; shouldListen = true;
while (shouldListen) while (shouldListen)
{ {
var cr = consumer.Consume(125); var cr = consumer.Consume();
if (cr != null) if (cr != null)
{ {
var typeHaver = JsonConvert.DeserializeAnonymousType(cr.Message.Value, new { type = "" }); var typeHaver = JsonConvert.DeserializeAnonymousType(cr.Message.Value, new { type = "" });
@ -143,16 +141,6 @@ namespace franz
} }
} }
} }
}
catch (System.OperationCanceledException)
{
Console.WriteLine("cancelled");
}
catch (Confluent.Kafka.ConsumeException e)
{
Console.Error.WriteLine(JsonConvert.SerializeObject(e));
throw;
}
}); });
} }
public void StopListening() public void StopListening()

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<PackageId>franz</PackageId> <PackageId>silvermeddlists.franz</PackageId>
<Version>0.0.1</Version> <Version>0.0.1</Version>
<Authors>adam</Authors> <Authors>adam</Authors>
<Company>Silver Meddlists</Company> <Company>Silver Meddlists</Company>