-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathmain.py
38 lines (31 loc) · 1.01 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import asyncio
import decimal
import gc
import platform
import nest_asyncio
from dotenv import load_dotenv
from explorer import Explorer
from util.set_proc_title import set_proc_title, set_thread_title
nest_asyncio.apply()
load_dotenv()
async def main():
if platform.python_implementation() == "CPython":
# https://mkennedy.codes/posts/python-gc-settings-change-this-and-make-your-app-go-20pc-faster/
# Clean up what might be garbage so far.
gc.collect(2)
# Exclude current items from future GC.
gc.freeze()
allocs, gen1, gen2 = gc.get_threshold()
allocs = 200_000 # Start the GC sequence every 200K not 700 allocations.
gen1 = gen1 * 5
gen2 = gen2 * 5
gc.set_threshold(allocs, gen1, gen2)
set_proc_title("aleo-explorer")
set_thread_title("aleo-explorer: main")
decimal.getcontext().prec = 80
e = Explorer()
e.start()
while True:
await asyncio.sleep(3600)
if __name__ == '__main__':
asyncio.run(main())