#!/usr/bin/env bun

import Redis from 'ioredis';
import { Queue } from 'bullmq';

const redis = new Redis({
  host: 'localhost',
  port: 6379,
  db: 0,
});

const queue = new Queue('{data-ingestion_webshare}', {
  connection: redis,
});

async function triggerJob() {
  console.log('Triggering webshare fetch-proxies job...');
  
  const job = await queue.add('fetch-proxies', {
    handler: 'webshare',
    operation: 'fetch-proxies',
    payload: {},
  });
  
  console.log(`Job ${job.id} added to queue`);
  
  await redis.quit();
  process.exit(0);
}

triggerJob().catch(console.error);