feat: Add Advoware History and Watcher services for document synchronization
- Implement AdvowareHistoryService for fetching and creating history entries. - Implement AdvowareWatcherService for file operations including listing, downloading, and uploading with Blake3 hash verification. - Introduce Blake3 utility functions for hash computation and verification. - Create document sync cron step to poll Redis for pending Aktennummern and emit sync events. - Develop document sync event handler to manage 3-way merge synchronization for Akten, including metadata updates and error handling.
This commit is contained in:
@@ -85,6 +85,7 @@ class RedisClientFactory:
|
||||
redis_host = os.getenv('REDIS_HOST', 'localhost')
|
||||
redis_port = int(os.getenv('REDIS_PORT', '6379'))
|
||||
redis_db = int(os.getenv('REDIS_DB_ADVOWARE_CACHE', '1'))
|
||||
redis_password = os.getenv('REDIS_PASSWORD', None) # Optional password
|
||||
redis_timeout = int(os.getenv('REDIS_TIMEOUT_SECONDS', '5'))
|
||||
redis_max_connections = int(os.getenv('REDIS_MAX_CONNECTIONS', '50'))
|
||||
|
||||
@@ -95,15 +96,22 @@ class RedisClientFactory:
|
||||
|
||||
# Create connection pool
|
||||
if cls._connection_pool is None:
|
||||
cls._connection_pool = redis.ConnectionPool(
|
||||
host=redis_host,
|
||||
port=redis_port,
|
||||
db=redis_db,
|
||||
socket_timeout=redis_timeout,
|
||||
socket_connect_timeout=redis_timeout,
|
||||
max_connections=redis_max_connections,
|
||||
decode_responses=True # Auto-decode bytes to strings
|
||||
)
|
||||
pool_kwargs = {
|
||||
'host': redis_host,
|
||||
'port': redis_port,
|
||||
'db': redis_db,
|
||||
'socket_timeout': redis_timeout,
|
||||
'socket_connect_timeout': redis_timeout,
|
||||
'max_connections': redis_max_connections,
|
||||
'decode_responses': True # Auto-decode bytes to strings
|
||||
}
|
||||
|
||||
# Add password if configured
|
||||
if redis_password:
|
||||
pool_kwargs['password'] = redis_password
|
||||
logger.info("Redis authentication enabled")
|
||||
|
||||
cls._connection_pool = redis.ConnectionPool(**pool_kwargs)
|
||||
|
||||
# Create client from pool
|
||||
client = redis.Redis(connection_pool=cls._connection_pool)
|
||||
|
||||
Reference in New Issue
Block a user