Each 30m refresh context and check for claimable bonus. Reference for #114

This commit is contained in:
Alessandro Maggio
2021-03-28 00:01:32 +01:00
parent bea8bb8428
commit 2f373bf101

View File

@@ -276,6 +276,7 @@ class TwitchChannelPointsMiner:
PubsubTopic("predictions-channel-v1", streamer=streamer)
)
refresh_context = time.time()
while self.running:
time.sleep(random.uniform(20, 60))
# Do an external control for WebSocket. Check if the thread is running
@@ -291,6 +292,14 @@ class TwitchChannelPointsMiner:
)
WebSocketsPool.handle_reconnection(self.ws_pool.ws[index])
if ((time.time() - refresh_context) // 60) >= 30:
refresh_context = time.time()
for index in range(0, len(self.streamers)):
if self.streamers[index].is_online:
self.twitch.load_channel_points_context(
self.streamers[index]
)
def end(self, signum, frame):
logger.info("CTRL+C Detected! Please wait just a moment!")