mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
refactor: consolidate aria2 process management into state and remove global variables
This commit is contained in:
+15
-16
@@ -1,20 +1,19 @@
|
||||
from core.network.aria2_integration import set_threads
|
||||
from core.utils.state import state
|
||||
|
||||
|
||||
def restart_aria2c(aria2process):
|
||||
import main # had to do this because of circle import :(
|
||||
import signal
|
||||
import atexit
|
||||
main.kill_aria2server(aria2process)
|
||||
aria2process.wait()
|
||||
aria2process = main.run_aria2server()
|
||||
signal.signal(signal.SIGINT, main.keyboardinterrupthandler)
|
||||
atexit.unregister(main.kill_aria2server)
|
||||
atexit.register(main.kill_aria2server, aria2process)
|
||||
def restart_aria2c():
|
||||
import main # had to do this because of circle import :(
|
||||
import signal
|
||||
import atexit
|
||||
main.kill_aria2server()
|
||||
state.aria2process.wait()
|
||||
state.aria2process = main.run_aria2server()
|
||||
signal.signal(signal.SIGINT, main.keyboardinterrupthandler)
|
||||
atexit.unregister(main.kill_aria2server)
|
||||
atexit.register(main.kill_aria2server)
|
||||
|
||||
def save_settings(thread_count, close, apiurl, aria2process):
|
||||
global api_url
|
||||
set_threads(thread_count)
|
||||
api_url = apiurl
|
||||
restart_aria2c(aria2process)
|
||||
def save_settings(thread_count, close, apiurl):
|
||||
state.aria2_threads = thread_count
|
||||
state.api_url = apiurl
|
||||
restart_aria2c()
|
||||
close()
|
||||
Reference in New Issue
Block a user