queen-mq 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -545,9 +545,9 @@ export const createStatusRoutes = (pool) => {
545
545
  if (status === 'failed') {
546
546
  conditions.push(`EXISTS (SELECT 1 FROM queen.dead_letter_queue dlq WHERE dlq.message_id = m.id)`);
547
547
  } else if (status === 'completed') {
548
- conditions.push(`(m.created_at, m.id) <= (pc.last_consumed_created_at, pc.last_consumed_id)`);
548
+ conditions.push(`(m.created_at < pc.last_consumed_created_at OR (DATE_TRUNC('milliseconds', m.created_at) = DATE_TRUNC('milliseconds', pc.last_consumed_created_at) AND m.id <= pc.last_consumed_id))`);
549
549
  } else if (status === 'pending') {
550
- conditions.push(`(m.created_at, m.id) > (COALESCE(pc.last_consumed_created_at, '1970-01-01'::timestamptz), COALESCE(pc.last_consumed_id, '00000000-0000-0000-0000-000000000000'::uuid))`);
550
+ conditions.push(`(m.created_at > COALESCE(pc.last_consumed_created_at, '1970-01-01'::timestamptz) OR (DATE_TRUNC('milliseconds', m.created_at) = DATE_TRUNC('milliseconds', COALESCE(pc.last_consumed_created_at, '1970-01-01'::timestamptz)) AND m.id > COALESCE(pc.last_consumed_id, '00000000-0000-0000-0000-000000000000'::uuid)))`);
551
551
  }
552
552
  }
553
553
 
@@ -570,7 +570,7 @@ export const createStatusRoutes = (pool) => {
570
570
  p.name as partition,
571
571
  CASE
572
572
  WHEN EXISTS (SELECT 1 FROM queen.dead_letter_queue dlq WHERE dlq.message_id = m.id) THEN 'failed'
573
- WHEN (m.created_at, m.id) <= (COALESCE(pc.last_consumed_created_at, '1970-01-01'::timestamptz), COALESCE(pc.last_consumed_id, '00000000-0000-0000-0000-000000000000'::uuid)) THEN 'completed'
573
+ WHEN (m.created_at < COALESCE(pc.last_consumed_created_at, '1970-01-01'::timestamptz) OR (DATE_TRUNC('milliseconds', m.created_at) = DATE_TRUNC('milliseconds', COALESCE(pc.last_consumed_created_at, '1970-01-01'::timestamptz)) AND m.id <= COALESCE(pc.last_consumed_id, '00000000-0000-0000-0000-000000000000'::uuid))) THEN 'completed'
574
574
  WHEN pc.lease_expires_at IS NOT NULL AND pc.lease_expires_at > NOW() THEN 'processing'
575
575
  ELSE 'pending'
576
576
  END as status,
@@ -625,7 +625,7 @@ export const createStatusRoutes = (pool) => {
625
625
  };
626
626
 
627
627
  if (!row.is_encrypted) {
628
- message.payload = row.payload;
628
+ message.data = row.payload;
629
629
  }
630
630
 
631
631
  if (row.status === 'pending' || row.status === 'processing') {