Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cache update reliability and monitoring #43

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

neubig
Copy link
Contributor

@neubig neubig commented Dec 18, 2024

This PR improves the reliability of the cache update system and adds better monitoring capabilities.

Changes

  1. Improved Error Handling and Retries
  • Added retry mechanism with configurable attempts
  • Added rate limit detection and handling
  • Better error logging with detailed information
  • Added User-Agent header to prevent GitHub API issues
  1. Better Monitoring and Logging
  • Created a new status endpoint (/api/status.js)
  • Added detailed logging in the cron job
  • Created a monitoring script (monitor-cache.ts)
  • Status file tracks last successful update and errors
  1. Improved Cache Building Process
  • Modified the cron endpoint to handle errors better
  • Added status tracking during cache updates
  • Created a safer cache building script (build:cache:safe)
  1. Added Health Checks
  • New monitoring script to check cache health
  • Checks for cache staleness (>12 hours old)
  • Verifies cache content validity
  • Reports detailed status information

Testing

To test these changes:

  1. Run npm run monitor:cache to check cache health
  2. Visit /api/status endpoint to view cache status
  3. Try npm run build:cache:safe to test the safer cache building process

Notes

Make sure the following environment variables are set in Vercel:

  • GITHUB_TOKEN
  • CRON_SECRET

- Add retry mechanism and rate limit handling to GitHub API calls
- Create monitoring system for cache health
- Add detailed logging and status tracking
- Implement safer cache building process
- Add status endpoint for monitoring
Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
openhands-agent-monitor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 7:14pm

- Add proper error handling in fetchWithAuth function
- Fix template literal type issues
- Move monitor-cache.ts to src directory
- Add String() conversion for numeric template literals
@neubig neubig merged commit a915e24 into main Dec 20, 2024
6 checks passed
@neubig neubig deleted the improve-cache-reliability branch December 20, 2024 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants