Commit 6fc5fa8
authored
fix: correct type mismatches in DLQ process_failed_jobs (#3)
Fixes two type mismatches when reading from graphile_worker's jobs
table:
1. **priority**: Changed from `i32` to `i16` to match graphile_worker's
`smallint` type
2. **last_error**: Changed from `Option<serde_json::Value>` to
`Option<String>` to match graphile_worker's `TEXT` type, with conversion
to JSONB for DLQ insert
## Problem
These mismatches caused the worker to crash with ColumnDecode errors
when attempting to move failed jobs to the DLQ:
- priority: `Rust type 'i32' is not compatible with SQL type 'INT2'`
- last_error: `Rust type 'Option<serde_json::Value>' is not compatible
with SQL type 'TEXT'`
## Root Cause
The graphile_worker library uses `smallint` (INT2/i16) for priority and
`TEXT` for last_error, while the backfill_dlq table expects `INTEGER`
and `JSONB` respectively.
## Solution
This fix reads the correct types from the source table and converts
`last_error` from TEXT to JSONB before inserting into DLQ.
## Additional Fixes
To make CI pass, this PR also includes fixes for pre-existing issues:
- Fixed clippy warning: derive `Default` for `Queue` enum instead of
manual implementation
- Fixed doctest failures: added missing `Serialize`/`Deserialize`
derives and explicit type annotations
## Testing
All DLQ tests pass (18/18):
- `test_dlq_process_failed_jobs_empty`
- `test_dlq_process_failed_jobs_with_mock_data`
- And 16 other DLQ-related tests1 parent 3bfce1a commit 6fc5fa8
2 files changed
Lines changed: 8 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
561 | | - | |
| 561 | + | |
562 | 562 | | |
563 | 563 | | |
564 | 564 | | |
565 | | - | |
| 565 | + | |
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
569 | 572 | | |
570 | 573 | | |
571 | 574 | | |
| |||
590 | 593 | | |
591 | 594 | | |
592 | 595 | | |
593 | | - | |
| 596 | + | |
594 | 597 | | |
595 | 598 | | |
596 | 599 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | 112 | | |
118 | 113 | | |
119 | 114 | | |
| |||
0 commit comments