mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Configure Redis to not write to disk and also run in unprotect mode if running in debug mode.
This commit is contained in:
parent
1aac0f8011
commit
1772bc7257
1 changed files with 18 additions and 0 deletions
|
|
@ -52,6 +52,24 @@ class RedisClient:
|
|||
# Validate connection with ping
|
||||
client.ping()
|
||||
client.flushdb()
|
||||
|
||||
# Disable persistence on first connection - improves performance
|
||||
# Only try to disable if not in a read-only environment
|
||||
try:
|
||||
client.config_set('save', '') # Disable RDB snapshots
|
||||
client.config_set('appendonly', 'no') # Disable AOF logging
|
||||
|
||||
# Disable protected mode when in debug mode
|
||||
if os.environ.get('DISPATCHARR_DEBUG', '').lower() == 'true':
|
||||
client.config_set('protected-mode', 'no') # Disable protected mode in debug
|
||||
logger.warning("Redis protected mode disabled for debug environment")
|
||||
|
||||
logger.trace("Redis persistence disabled for better performance")
|
||||
except redis.exceptions.ResponseError:
|
||||
# This might fail if Redis is configured to prohibit CONFIG command
|
||||
# or if running in protected mode - that's okay
|
||||
logger.error("Could not modify Redis persistence settings (may be restricted)")
|
||||
|
||||
logger.info(f"Connected to Redis at {redis_host}:{redis_port}/{redis_db}")
|
||||
|
||||
cls._client = client
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue