2022-11-23 07:24:05 +00:00
|
|
|
import logging
|
|
|
|
|
2023-04-15 15:17:33 +00:00
|
|
|
import gc
|
|
|
|
import musicbrainzngs
|
|
|
|
|
2023-06-20 15:07:32 +00:00
|
|
|
from .utils.config import read_config
|
2023-06-20 14:40:34 +00:00
|
|
|
from .utils.shared import MODIFY_GC
|
2023-06-20 15:07:32 +00:00
|
|
|
from . import cli
|
2023-04-18 07:02:03 +00:00
|
|
|
|
2023-04-04 20:07:56 +00:00
|
|
|
if MODIFY_GC:
|
|
|
|
"""
|
|
|
|
At the start I modify the garbage collector to run a bit fewer times.
|
|
|
|
This should increase speed:
|
|
|
|
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)
|
|
|
|
|
|
|
|
allocs, gen1, gen2 = gc.get_threshold()
|
|
|
|
allocs = 50_000 # Start the GC sequence every 50K not 700 allocations.
|
|
|
|
gen1 = gen1 * 2
|
|
|
|
gen2 = gen2 * 2
|
|
|
|
gc.set_threshold(allocs, gen1, gen2)
|
2022-11-24 21:10:22 +00:00
|
|
|
|
2022-11-22 13:53:29 +00:00
|
|
|
logging.getLogger("musicbrainzngs").setLevel(logging.WARNING)
|
|
|
|
musicbrainzngs.set_useragent("metadata receiver", "0.1", "https://github.com/HeIIow2/music-downloader")
|