Skip to content

Commit 5dcfdf2

Browse files
committed
Release v0.26.1
1 parent 97e2c0c commit 5dcfdf2

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

integration_tests/base_routes.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import os
2+
3+
24
import pathlib
35

46
from robyn import WS, Robyn, Request, Response, jsonify, serve_file, serve_html

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ name = "robyn"
1212
dependencies = [
1313
'watchdog == 2.2.1',
1414
'multiprocess == 0.70.14',
15-
'psutil == 5.9.4',
1615
'nestd == 0.3.1',
1716
# conditional
1817
'uvloop == 0.17.0; sys_platform == "darwin"',

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ maturin==0.14.12
22
uvloop; platform_system!="Windows"
33
watchdog==2.2.1
44
multiprocess==0.70.14
5-
psutil==5.9.4
65
jinja2==3.1.2
76
nestd==0.3.1

robyn/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, file_object: str, config: Config = Config()) -> None:
3333

3434
# If we are in dev mode, we need to setup the reloader
3535
# This process will be used by the watchdog observer while running the actual server as children processes
36-
if self.config.dev and not os.environ.get("IS_RELOADER_SETUP", False):
36+
if self.config.dev and not os.environ.get("IS_RELOADER_RUNNING", False):
3737
setup_reloader(self.directory_path, self.file_path)
3838
exit(0)
3939

robyn/reloader.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import subprocess
44
import sys
55
import time
6-
import psutil
76

87
from watchdog.events import FileSystemEventHandler
98
from watchdog.observers import Observer
@@ -45,23 +44,23 @@ def terminating_signal_handler(_sig, _frame):
4544
class EventHandler(FileSystemEventHandler):
4645
def __init__(self, file_path: str) -> None:
4746
self.file_path = file_path
47+
self.process = None # Keep track of the subprocess
4848

49-
self.last_reload = time.time()
49+
self.last_reload = time.time() # Keep track of the last reload. EventHandler is initialized with the process.
5050

5151
def stop_server(self):
52-
for process in psutil.Process().children(recursive=True):
53-
process.kill()
54-
process.wait() # Required to avoid zombies
52+
if self.process:
53+
os.kill(self.process.pid, signal.SIGTERM) # Stop the subprocess using os.kill()
5554

5655
def reload(self):
5756
self.stop_server()
5857

5958
new_env = os.environ.copy()
6059
new_env[
61-
"IS_RELOADER_SETUP"
60+
"IS_RELOADER_RUNNING"
6261
] = "True" # This is used to check if a reloader is already running
6362

64-
subprocess.Popen(
63+
self.process = subprocess.Popen(
6564
[sys.executable, *sys.argv],
6665
env=new_env,
6766
start_new_session=False,
@@ -82,3 +81,4 @@ def on_modified(self, event) -> None:
8281

8382
time.sleep(0.2) # Wait for the file to be fully written
8483
self.reload()
84+

0 commit comments

Comments
 (0)