Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
fix mq timeout units
Browse files Browse the repository at this point in the history
  • Loading branch information
liisaratsep committed Jun 30, 2022
1 parent 6004031 commit 666d3c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Environment variables:
- `MQ_PASSWORD` - RabbitMQ user password
- `MQ_HOST` - RabbitMQ host
- `MQ_PORT` (optional) - RabbitMQ port (`5672` by default)
- `MQ_TIMEOUT` (optional) - Message timeout in milliseconds (`1200000` by default)
- `MQ_TIMEOUT` (optional) - Message timeout in seconds (`1200` by default)
- `MQ_EXCHANGE` (optional) - RabbitMQ exchange name (`speech-to-text` by default)
- Configuration to connect to a MySQL database:
- `MYSQL_HOST` - MySQL hostname
Expand All @@ -34,7 +34,7 @@ Environment variables:
return transcriptions)
- `API_PASSWORD` - password that the ASR worker component will use to authenticate itself
- Cleanup configuration for files and database records:
- `API_CLEANUP_INTERVAL` (optional) - how often cleanup is initiated (in seconds, `600` by default)
- `API_CLEANUP_INTERVAL` (optional) - how often cleanup is initiated (in seconds, `60` by default)
- `API_EXPIRATION_THRESHOLD` (optional) - number of seconds after which the job is marked as cancelled (if the job
was still in progress) or expired (if the job was done) in the database and its files are deleted (`1200` by
default)
Expand Down
2 changes: 2 additions & 0 deletions app/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ async def _run():
await aiofiles.os.remove(os.path.join(api_settings.storage_path, f"{job_id}.txt"))
await aiofiles.os.remove(os.path.join(api_settings.storage_path, f"{job_id}.wav"))

LOGGER.info("Cleanup finished.")


class Cleanup:
_running = False
Expand Down
4 changes: 2 additions & 2 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class APISettings(BaseSettings):
version: str
username: str = 'user'
password: str = 'pass'
cleanup_interval: int = 600 # 10 minutes - run db & file cleanup
cleanup_interval: int = 60 # 1 minute - run db & file cleanup
expiration_threshold: int = 1200 # 20 minutes - expire / cancel jobs without updates
removal_threshold: int = 86400 # 24 h - remove db records after expiration / cancellation

Expand All @@ -21,7 +21,7 @@ class MQSettings(BaseSettings):
username: str = 'guest'
password: str = 'guest'
exchange: str = 'speech-to-text'
timeout: int = 1200000 # 120 minutes
timeout: int = 1200 # 20 minutes

class Config:
env_prefix = 'mq_'
Expand Down

0 comments on commit 666d3c2

Please sign in to comment.