Skip to content

Commit

Permalink
Better tick connected checking
Browse files Browse the repository at this point in the history
Sleeping between the check and the action resulted in a 50ms window
  • Loading branch information
grepsedawk committed Jul 29, 2023
1 parent a84cd64 commit efb4419
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rosegold/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ class Rosegold::Client < Rosegold::EventEmitter

def start_ticker
spawn do
while connected?
loop do
sleep 1.tick

break unless connected?

spawn do
interactions.tick
physics.tick
Expand Down

0 comments on commit efb4419

Please sign in to comment.