const Redis = require('ioredis');
const redis = new Redis();

async function clearQueue() {
  console.log('清空Redis中的书籍生成队列...');
  
  // 删除所有bull队列相关key
  const keys = await redis.keys('bull:book:generation:*');
  if (keys.length > 0) {
    await redis.del(...keys);
    console.log(`✅ 已删除 ${keys.length} 个队列key`);
  } else {
    console.log('队列已空');
  }
  
  await redis.quit();
}

clearQueue();
