Files
cannaiq/backend/archive/check-proxy-stats.js
Kelly d91c55a344 feat: Add stale process monitor, users route, landing page, archive old scripts
- Add backend stale process monitoring API (/api/stale-processes)
- Add users management route
- Add frontend landing page and stale process monitor UI on /scraper-tools
- Move old development scripts to backend/archive/
- Update frontend build with new features

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 04:07:31 -07:00

37 lines
1.2 KiB
JavaScript

const { Pool } = require('pg');
const pool = new Pool({
connectionString: process.env.DATABASE_URL || 'postgresql://kelly:kelly@localhost:5432/hub'
});
(async () => {
try {
const stats = await pool.query(`
SELECT
COUNT(*) as total,
COUNT(*) FILTER (WHERE active = true) as active,
COUNT(*) FILTER (WHERE active = false) as inactive,
COUNT(*) FILTER (WHERE test_result = 'success') as passed,
COUNT(*) FILTER (WHERE test_result = 'failed') as failed,
COUNT(*) FILTER (WHERE test_result IS NULL) as untested
FROM proxies
`);
const s = stats.rows[0];
console.log('\n📊 Proxy Statistics:');
console.log('='.repeat(60));
console.log(`Total Proxies: ${s.total}`);
console.log(`Active: ${s.active} (passing tests)`);
console.log(`Inactive: ${s.inactive} (failed tests)`);
console.log(`Test Results:`);
console.log(` ✅ Passed: ${s.passed}`);
console.log(` ❌ Failed: ${s.failed}`);
console.log(` ⚪ Untested: ${s.untested}`);
process.exit(0);
} catch (error) {
console.error('Error:', error);
process.exit(1);
}
})();