Skip to content

Commit

Permalink
Don't wait forever
Browse files Browse the repository at this point in the history
  • Loading branch information
bararchy committed Aug 8, 2023
1 parent ff6cafc commit 448319d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/sec_tester/repeater.cr
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module SecTester
# handle undeployed events
@socket.on("undeployed") do |_|
@id = ""
@socket.off("undeployed")
end

Log.debug { "Repeater started" }
Expand Down
8 changes: 6 additions & 2 deletions src/sec_tester/scan.cr
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ module SecTester
spawn do
@repeater.run
end
while @repeater.id.empty?
# Wait for repeater to get ID
# Don't wait forever, if repeater is not running, we will get an error
# after 30 seconds

30.times do
break unless @repeater.id.empty?
sleep 1.second
Fiber.yield
Log.debug { "Waiting for repeater to get ID" }
end
end
Expand Down

0 comments on commit 448319d

Please sign in to comment.