| | |
| | | /** 单条待办「正在上报」Redis 占位秒数(SET NX EX) */ |
| | | private static final int CLOUD_WMS_NOTIFY_SENDING_REDIS_TTL_SECONDS = 120; |
| | | /** sending=1 但 Redis 无占位:update_time 早于此时长(分钟)则补偿清零 */ |
| | | private static final int STALE_SENDING_RECOVER_AFTER_MINUTES = 6; |
| | | private static final int STALE_SENDING_RECOVER_AFTER_MINUTES = 2; |
| | | |
| | | @Autowired |
| | | private ConfigService configService; |
| | |
| | | @Override |
| | | public List<CloudWmsNotifyLog> listPending(int limit, int maxRetry) { |
| | | LambdaQueryWrapper<CloudWmsNotifyLog> wrapper = new LambdaQueryWrapper<CloudWmsNotifyLog>() |
| | | // 仅查询数据库配置状态:待通知 + 失败(可重试) |
| | | // 仅查询数据库配置状态 |
| | | .in(CloudWmsNotifyLog::getNotifyStatus, getNotifyStatusPending(), getNotifyStatusFail()) |
| | | .apply("(send_hold IS NULL OR send_hold = 0)") |
| | | // 仅查询可重试数据:无限重试、未配置上限、或未达到上限 |
| | | // 仅查询可重试数据 |
| | | .apply("(max_retry_count IS NULL OR max_retry_count = -1 OR retry_count < max_retry_count)") |
| | | // 仅查询已到重试时间的数据,避免前 50 条未到间隔导致后续记录长期饥饿 |
| | | // 仅查询已到重试时间的数据 |
| | | .apply("(last_notify_time IS NULL OR retry_interval_seconds IS NULL OR retry_interval_seconds <= 0 OR TIMESTAMPDIFF(SECOND, last_notify_time, NOW()) >= retry_interval_seconds)") |
| | | //缺重试参数的不进入待发送列表 |
| | | .isNotNull(CloudWmsNotifyLog::getMaxRetryCount) |