mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-30 22:05:28 +00:00
Do not reload plugins from disk
Reloading from disk causes modules to be re-evaluated, and this is often not desirable. This will break the ability to hot reload plugins
This commit is contained in:
@@ -27,7 +27,7 @@ import threading
|
|||||||
import time
|
import time
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from hashlib import sha256, md5
|
from hashlib import sha256, md5
|
||||||
from importlib import import_module, reload
|
from importlib import import_module
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from signal import signal, SIGINT, SIGTERM, SIGABRT
|
from signal import signal, SIGINT, SIGTERM, SIGABRT
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
@@ -1523,7 +1523,7 @@ class Client(Methods, BaseClient):
|
|||||||
if not include:
|
if not include:
|
||||||
for path in sorted(Path(root.replace(".", "/")).rglob("*.py")):
|
for path in sorted(Path(root.replace(".", "/")).rglob("*.py")):
|
||||||
module_path = '.'.join(path.parent.parts + (path.stem,))
|
module_path = '.'.join(path.parent.parts + (path.stem,))
|
||||||
module = reload(import_module(module_path))
|
module = import_module(module_path)
|
||||||
|
|
||||||
for name in vars(module).keys():
|
for name in vars(module).keys():
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
@@ -1545,7 +1545,7 @@ class Client(Methods, BaseClient):
|
|||||||
warn_non_existent_functions = True
|
warn_non_existent_functions = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
module = reload(import_module(module_path))
|
module = import_module(module_path)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
log.warning('[{}] [LOAD] Ignoring non-existent module "{}"'.format(
|
log.warning('[{}] [LOAD] Ignoring non-existent module "{}"'.format(
|
||||||
self.session_name, module_path))
|
self.session_name, module_path))
|
||||||
|
Reference in New Issue
Block a user