Skip to content

Commit

Permalink
reconnect ws every 5 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Feb 6, 2023
1 parent 8db9cce commit fe86669
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# import asyncio
import json
import logging
import os
import re
import threading

from flask import Flask, jsonify, request
from flask import Flask, jsonify, request, send_from_directory
from flask_cors import CORS, cross_origin
from flask_sock import Sock

Expand Down Expand Up @@ -45,7 +46,7 @@ def before_first_request():

# future: https://stackoverflow.com/questions/24101724/gunicorn-with-multiple-workers-is-there-an-easy-way-to-execute-certain-code-onl
tmrpc = TendermintRPCWebSocket(enableSignal=False, logLevel=logging.DEBUG)
t = threading.Thread(target=tmrpc.ws.run_forever)
t = threading.Thread(target=tmrpc.ws.run_forever, kwargs={"reconnect": 5})
t.daemon = True
t.start()

Expand Down Expand Up @@ -106,11 +107,6 @@ def use_redis_hashset(path):
return False


import os

from flask import send_from_directory


@rpc_app.route("/favicon.ico")
def favicon():
return send_from_directory(
Expand Down

0 comments on commit fe86669

Please sign in to comment.