queue.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. //return [
  3. // 'connector' => 'Redis', // Redis 驱动
  4. // 'expire' => 60, // 任务的过期时间,默认为60秒; 若要禁用,则设置为 null
  5. // 'default' => 'default', // 默认的队列名称
  6. // 'host' => '127.0.0.1', // redis 主机ip
  7. // 'port' => 6379, // redis 端口
  8. // 'password' => '', // redis 密码
  9. // 'select' => 15, // 使用哪一个 db,默认为 db0
  10. // 'timeout' => 0, // redis连接的超时时间
  11. // 'persistent' => false,
  12. //];
  13. // config/queue.php
  14. return [
  15. 'connector' => 'Redis', // Redis 驱动
  16. 'expire' => 600, // 任务的过期时间
  17. 'default' => 'salary_calculation', // 默认队列名称改为工资计算
  18. 'host' => '127.0.0.1', // redis 主机ip
  19. 'port' => 6379, // redis 端口
  20. 'password' => '123456', // redis 密码
  21. 'select' => 15, // 使用哪一个 db
  22. 'timeout' => 0, // redis连接的超时时间
  23. 'persistent' => false,
  24. // 自定义配置 - 多队列支持
  25. 'queues' => [
  26. // 工资计算队列(默认队列,保持原有逻辑)
  27. 'salary_calculation' => [
  28. 'expire' => 600, // 10分钟超时
  29. 'delay' => 0,
  30. 'retry' => 2,
  31. ],
  32. // 成本计算队列(新增队列)
  33. 'cost_calculation' => [
  34. 'expire' => 1800, // 半小时超时
  35. 'delay' => 0, // 立即执行
  36. 'retry' => 3, // 重试次数
  37. ],
  38. // 低优先级队列
  39. 'low_priority' => [
  40. 'expire' => 3600, // 1小时超时
  41. 'delay' => 300, // 延迟5分钟执行
  42. 'retry' => 1,
  43. ]
  44. ],
  45. ];