diff --git a/Dockerfile b/Dockerfile index aea7f00..b8014a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -117,6 +117,9 @@ COPY --from=python-builder /usr/local/lib/python3.11/site-packages /usr/local/li COPY strategy/__init__.py /app/strategy/__init__.py COPY strategy/src /app/strategy/src +# Set PYTHONPATH for strategy module imports +ENV PYTHONPATH=/app + # Copy supervisor configuration COPY deploy/supervisord.conf /etc/supervisor/conf.d/supervisord.conf diff --git a/deploy/supervisord.conf b/deploy/supervisord.conf index 1c66ae6..82e0a9d 100644 --- a/deploy/supervisord.conf +++ b/deploy/supervisord.conf @@ -34,7 +34,7 @@ autostart=true autorestart=true stderr_logfile=/var/log/supervisor/strategy.err.log stdout_logfile=/var/log/supervisor/strategy.out.log -environment=DATABASE_URL="%(ENV_DATABASE_URL)s",TIMEZONE="%(ENV_TIMEZONE)s" +environment=DATABASE_URL="%(ENV_DATABASE_URL)s",TIMEZONE="%(ENV_TIMEZONE)s",PYTHONPATH="/app" priority=300 startsecs=10 startretries=3 diff --git a/market-data/src/websocket/manager.rs b/market-data/src/websocket/manager.rs index 2749654..fee5555 100644 --- a/market-data/src/websocket/manager.rs +++ b/market-data/src/websocket/manager.rs @@ -45,14 +45,14 @@ impl WebSocketManager { loop { // Reset reconnect attempts if we've been stable for a while if let Some(last_success) = self.last_successful_connection { - if last_success.elapsed() > Duration::from_secs(RECONNECT_COOLDOWN_SECS) { - if self.reconnect_attempts > 0 { - info!( - previous_attempts = self.reconnect_attempts, - "Resetting reconnect counter after cooldown period" - ); - self.reconnect_attempts = 0; - } + if last_success.elapsed() > Duration::from_secs(RECONNECT_COOLDOWN_SECS) + && self.reconnect_attempts > 0 + { + info!( + previous_attempts = self.reconnect_attempts, + "Resetting reconnect counter after cooldown period" + ); + self.reconnect_attempts = 0; } }