Skip to content

Commit 27cad32

Browse files
committed
ADD sleep to prevent CPU spin
1 parent 683b4e8 commit 27cad32

File tree

1 file changed

+2
-0
lines changed
  • src/gh/components/DF_tcp_listener

1 file changed

+2
-0
lines changed

src/gh/components/DF_tcp_listener/code.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import socket
55
import threading
66
import json
7+
import time
78
import scriptcontext as sc
89
import Rhino.Geometry as rg
910
import System.Drawing as sd
@@ -66,6 +67,7 @@ def handle_client(conn):
6667
sc.sticky[f'{prefix}_cloud_buffer_raw'] = raw
6768
except Exception:
6869
break
70+
time.sleep(0.05) # sleep briefly to prevent CPU spin
6971

7072
# thread to accept incoming connections
7173
def server_loop(sock):

0 commit comments

Comments
 (0)