a digital person for bluesky

Optimize X API usage to reduce rate limit issues

- Enable caching during thread context processing (was disabled, causing 50-80% more API calls)
- Increase fetch delay from 60s to 120s to reduce API call frequency
- These changes should significantly reduce API usage and prevent rate limit violations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+3 -3
+3 -3
x.py
··· 1341 1341 logger.warning(f"❌ No conversation_id found for mention {mention_id} - this may cause thread context issues") 1342 1342 return None 1343 1343 1344 - # Get thread context (disable cache for missing context issues) 1344 + # Get thread context with caching enabled for efficiency 1345 1345 # Use mention_id as until_id to exclude tweets that occurred after this mention 1346 1346 try: 1347 - thread_data = x_client.get_thread_context(conversation_id, use_cache=False, until_id=mention_id) 1347 + thread_data = x_client.get_thread_context(conversation_id, use_cache=True, until_id=mention_id) 1348 1348 if not thread_data: 1349 1349 logger.error(f"❌ Failed to get thread context for conversation {conversation_id}") 1350 1350 return False ··· 1978 1978 logger.info("Connected to X API") 1979 1979 1980 1980 # Main loop 1981 - FETCH_DELAY_SEC = 60 # Check every minute for X mentions 1981 + FETCH_DELAY_SEC = 120 # Check every 2 minutes for X mentions (reduced from 60s to conserve API calls) 1982 1982 logger.info(f"Starting X mention monitoring, checking every {FETCH_DELAY_SEC} seconds") 1983 1983 1984 1984 if testing_mode: