MemeKingz / Shitcoins

0 stars 0 forks source link

Handle docker container crashing #29

Open oiyoiyoi opened 4 months ago

oiyoiyoi commented 4 months ago

""" Traceback (most recent call last): File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "/usr/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar return list(map(args)) File "/home/sam/Shitcoins/shitcoins/check_holder_transfers.py", line 107, in check_holder conn = psycopg2.connect( File "/home/sam/Shitcoins/venv/lib/python3.10/site-packages/psycopg2/init.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5333 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/sam/Shitcoins/shitcoins/main.py", line 64, in asyncio.run(main()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/sam/Shitcoins/shitcoins/main.py", line 42, in main coin_data_with_updated_holders = multiprocess_coin_holders(coin_data) File "/home/sam/Shitcoins/shitcoins/check_holder_transfers.py", line 152, in multiprocess_coin_holders updated_holders = pool.map(check_holder, coin_data['holders']) File "/usr/lib/python3.10/multiprocessing/pool.py", line 367, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get raise self._value psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5333 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?

Wallet-db crashed during run

maybe we could create a bash script that checks: if wallet-db is running: continue else: run 'docker start wallet-db' and then implement error handling where if we get this error: psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5333 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? it will run the bash script and try again?

anton-lam commented 3 months ago

Is port 5333 the database? If so this has something more with the db going down during running, so we should handle the exception instead of wrapping the app in a bash script imo