Latest News from India

Last updated: 1 hour ago

Cache files exist: Headlines (Yes) | General (Yes) | Check debug log: api_debug.log
I've added debugging functionality that will help us identify why you're hitting the API limit. Here's what the debug version does: **New Features:** 1. **API Call Logging**: Every API call, cache hit, and error is logged to `api_debug.log` 2. **Cache Status Display**: Shows whether cache files exist at the bottom of the page 3. **Debug Log Link**: Click the link at the bottom to view the debug log **To diagnose the issue:** 1. Deploy this version and let it run for a day 2. Click the "api_debug.log" link at the bottom of your page to see what's happening 3. Look for patterns like: - Too many "API CALL" entries (should only be ~8 per day) - "ERROR: Failed to write cache file" (permission issues) - "CRITICAL: No cache available" (cache deletion problems) **Quick checks you can do right now:** 1. **Check if cache files exist:** ```bash ls -la /var/www/html/*.json ``` 2. **Check file permissions:** ```bash ls -la /var/www/html/headlines_cache.json ls -la /var/www/html/general_news_cache.json ``` 3. **Check how often files are being updated:** ```bash stat /var/www/html/headlines_cache.json ``` **Common causes of high API usage:** - **No caching working**: Every visitor triggers API calls - **High traffic**: Even with caching, if you get 1000+ unique visitors per day, that could be the issue - **Bots/crawlers**: Search engine bots might be triggering API calls - **Multiple domains**: If the same code runs on multiple domains Once you check the debug log, we'll know exactly what's causing the high API usage and can fix it accordingly.