Skip to content

Commit 4d6d51f

Browse files
committed
fix: update configuration options and enhance documentation for signal handling and graceful shutdown
1 parent 6e75e81 commit 4d6d51f

1 file changed

Lines changed: 31 additions & 10 deletions

File tree

README.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,26 @@ uv run checks
2929

3030
All settings are managed with Pydantic v2 and can be set via environment variables or a `.env` file:
3131

32-
| Variable | Type | Default | Description |
33-
|---------------|--------|--------------------------|------------------------------------|
34-
| TARGET_URL | str | https://httpbin.org/get | Target endpoint for benchmarking |
35-
| NUM_REQUESTS | int | 10 | Total number of requests |
36-
| CONCURRENCY | int | 2 | Number of concurrent requests |
37-
| TIMEOUT | float | 10.0 | Request timeout (seconds) |
38-
| LOG_LEVEL | str | INFO | Log level (DEBUG, INFO, etc.) |
32+
| Variable | Type | Default | Description |
33+
|------------------|--------|--------------------------|---------------------------------------------|
34+
| TARGET_URL | str | https://httpbin.org/get | Target endpoint for benchmarking |
35+
| NUM_REQUESTS | int | 10 | Total number of requests |
36+
| CONNECT_TIMEOUT | float | 1.0 | Connection timeout in seconds |
37+
| READ_TIMEOUT | float | 3.0 | Request timeout in seconds |
38+
| REQUEST_DELAY | float | 0.1 | Delay between requests in seconds |
39+
| LOG_LEVEL | str | INFO | Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
40+
| VERIFY_SSL | bool | True | Whether to verify SSL certificates |
3941

4042
Example `.env`:
4143

4244
```
4345
TARGET_URL=https://example.com/api
4446
NUM_REQUESTS=100
45-
CONCURRENCY=5
46-
TIMEOUT=5.0
47+
CONNECT_TIMEOUT=2.0
48+
READ_TIMEOUT=5.0
49+
REQUEST_DELAY=0.5
4750
LOG_LEVEL=DEBUG
51+
VERIFY_SSL=False
4852
```
4953

5054
## DevOps & Pythonic Practices
@@ -56,19 +60,36 @@ LOG_LEVEL=DEBUG
5660
- **CI/CD ready**: Semantic release and coverage tools are pre-configured.
5761
- **Type annotations**: All code is type-annotated for clarity and safety.
5862

63+
tests/
64+
65+
## Architecture
66+
67+
### Graceful Shutdown & Signal Handling
68+
69+
- Signal handling is modular: the signal handler function is defined at module scope and can be reused or tested independently.
70+
- `register_signals` simply registers this handler for SIGINT/SIGTERM, and the handler itself is not nested or dynamically created.
71+
- This makes the shutdown logic more testable, maintainable, and explicit.
72+
5973
## Project Structure
6074

6175
```
6276
src/python_response_time/
63-
main.py # Benchmark runner
77+
main.py # Benchmark runner, entry point, signal registration
6478
pre_flight.py # DevOps checks
6579
core/
6680
config.py # Pydantic v2 settings
6781
logging.py # Loguru setup
82+
startup.py # Signal handler and registration logic
6883
tests/
6984
test_basic.py # Pytest-based config tests
7085
```
7186

87+
## CI/CD Pipeline
88+
89+
- Linting, testing, and Docker image build are triggered on every push and pull request.
90+
- The pipeline is not affected by the signal handler refactor; no changes are required for this architectural update.
91+
- See `.github/workflows/ci-cd.yaml` for details.
92+
7293
## License
7394

7495
MIT

0 commit comments

Comments
 (0)