heartbeat ticks are stopped even if kws.is_connected() is true

AjayGhori
Greetings fellow developers,
I am logging ticks by below method but ticks are getting stop rarely, I am logging at every ticks and checking kws.is_connected() every minute.
##code
def on_ticks(ws, ticks):
global count2
print(count2, "tick") ## stops randomly
ticks_queue.put(ticks) # sending ticks for further processing
count2 += 1
##code
while flag1:
print(datetime.datetime.now(),": RUNNING", connections[0].is_connected())
sleep(60)
##code
Tagged:
  • sujith
    You can check out FAQs to know more about the tick frequency and how it behaves.
  • AjayGhori
    Thanks @sujith. I tried many solutions. I thought of manually restart also, but Reactor won't be able to reinitiated.
    It seems there is no direct solution to restart manually for now as reactor is using twisted-internet library.
    For now, I have created a fork subprocess of my main thread. Main Thread will kill the subprocess if any disconnection/noTicksWithinMin then make fresh new connection to kite.
Sign In or Register to comment.