Unified logging behaviour and added exponential backoff
- Logger doesn't start with log level DEBUG by default, instead reads a environment variable - Secret handler raises exceptions instead of using the module os to exit - Added extensive debug logging - Added detailed function descriptions - Added exponential backoff when parsing the RSS feed
This commit is contained in:
1 parent
14f974f4ed
commit
abc894869f
8 files changed
+217
-107
No files matched your search
@@ -1,3 +1,58 @@
|
||||
# service-royalroad-chapters
|
||||
# Service: Royalroad Chapters
|
||||
|
||||
Fetches new RR chapter data
|
||||
|
||||
## Overview
|
||||
|
||||
`service-royalroad-chapters` is a FastAPI-based webserver that monitors Royalroad stories for new chapters and sends notifications data to `backend-api-internal`.
|
||||
|
||||
## Features
|
||||
|
||||
- Fetches the latest chapters from Royalroad RSS feeds.
|
||||
|
||||
- Updates the database when new chapters are released.
|
||||
|
||||
- Sends push notifications for new chapters.
|
||||
|
||||
- Prometheus metrics integrated for monitoring request counts.
|
||||
|
||||
|
||||
## Endpoints
|
||||
### GET `/royalroad`
|
||||
- Checks for new chapters for all active stories in the database.
|
||||
- Updates the `lastChapter` field in the database.
|
||||
- Sends notifications if a new chapter is found.
|
||||
- Response:
|
||||
```json
|
||||
{
|
||||
"status": "checked"
|
||||
}
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.12+
|
||||
|
||||
- MySQL database
|
||||
|
||||
- Python packages from requirements.txt
|
||||
|
||||
## Configuration
|
||||
|
||||
**Environment variables:**
|
||||
|
||||
- `LOG_LEVEL` (DEBUG, INFO, WARNING, ERROR, CRITICAL)
|
||||
|
||||
- Database credentials: `MYSQL_HOST`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_DATABASE`
|
||||
|
||||
- `API_KEY_INTERNAL`
|
||||
|
||||
- `BACKEND_API_URL`
|
||||
|
||||
|
||||
## Metrics
|
||||
|
||||
Metrics are exposed on port `9000` for Prometheus
|
||||
|
||||
## Running the Service
|
||||
|
||||
- Inside the `src` folder `python main.py`
|
||||
Reference in new issue
Block a user