Skip to content

Commit

Permalink
Merge pull request #532 from evo-lua/uws-echo-flakiness
Browse files Browse the repository at this point in the history
Fix the flaky uws-echo-server test by using a ticker
  • Loading branch information
rdw-software authored Feb 22, 2024
2 parents 33b8e3a + 9cfd1c6 commit bdf9e21
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Tests/Integration/uws-echo-server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,27 @@ function client:WEBSOCKET_UPGRADE_COMPLETE()
registerNewMessageHandler()
end

local shutdownTimer = uv.new_timer()
shutdownTimer:start(250, 0, function()
local shutdownTicker
shutdownTicker = C_Timer.NewTicker(100, function()
if not receivedEchoedMessage then
print("Waiting for received echo message...")
return
end

if not hasUpdatedClientCount then
print("Waiting for updated client count...")
return
end

client:Disconnect()

uws.bindings.uws_webserver_stop(server)
uws.bindings.uws_webserver_delete(server)

shutdownTimer:stop()
shutdownTimer:close()
shutdownTicker:stop()
shutdownTicker:close()

uv.stop()

assertTrue(receivedEchoedMessage)
assertTrue(hasUpdatedClientCount)
end)

uv.run()

0 comments on commit bdf9e21

Please sign in to comment.