|
1 | 1 | # @vorsteh-queue/adapter-drizzle |
2 | 2 |
|
| 3 | +## 0.3.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- ccaacc2: Add job result storage functionality |
| 8 | + |
| 9 | + Job handlers can now return values that are automatically stored in the database and made available through events and job records. |
| 10 | + |
| 11 | + **New Features:** |
| 12 | + - Added optional `result` field to job records for storing handler return values |
| 13 | + - Enhanced `BaseJob` interface with generic result type parameter |
| 14 | + - Updated all adapters (Drizzle, Prisma, Memory) to support result storage |
| 15 | + - Results are accessible in `job:completed` events and job queries |
| 16 | + |
| 17 | + **Database Changes:** |
| 18 | + - Added `result` JSONB column to queue_jobs table in both Drizzle and Prisma schemas |
| 19 | + - Column is optional and backward compatible with existing jobs |
| 20 | + |
| 21 | + **API Changes:** |
| 22 | + - `JobHandler<TPayload, TResult>` now supports result type parameter |
| 23 | + - `updateJobStatus()` method accepts optional result parameter |
| 24 | + - Job completion events include result data |
| 25 | + |
| 26 | + **Examples:** |
| 27 | + |
| 28 | + ```typescript |
| 29 | + // Handler with typed result |
| 30 | + queue.register<EmailPayload, EmailResult>("send-email", async (job) => { |
| 31 | + await sendEmail(job.payload) |
| 32 | + return { messageId: "msg_123", sent: true } // Stored in job.result |
| 33 | + }) |
| 34 | + |
| 35 | + // Access results in events |
| 36 | + queue.on("job:completed", (job) => { |
| 37 | + console.log("Result:", job.result) // { messageId: "msg_123", sent: true } |
| 38 | + }) |
| 39 | + ``` |
| 40 | + |
| 41 | +- 5adb3a0: Add configurable job timeouts and rename `processingInterval` to `pollInterval`. |
| 42 | + |
| 43 | + **New Features:** |
| 44 | + - **Configurable job timeouts**: Set `timeout: number` for specific timeout or `timeout: false` to disable timeout completely |
| 45 | + - **Job-specific timeout override**: Individual jobs can override queue default timeout settings |
| 46 | + - **Timeout field storage**: Job timeout configuration is now stored in job records for proper handling |
| 47 | + |
| 48 | + **Breaking Changes:** |
| 49 | + - **Renamed `processingInterval` to `pollInterval`**: More accurately describes the interval between queue polling cycles |
| 50 | + - **Database schema changes**: Added `timeout` column to queue_jobs table (JSONB field, nullable) |
| 51 | + |
| 52 | + **Migration Guide:** |
| 53 | + |
| 54 | + ```typescript |
| 55 | + // Before |
| 56 | + const queue = new Queue(adapter, { |
| 57 | + name: "my-queue", |
| 58 | + processingInterval: 1000, // OLD |
| 59 | + }) |
| 60 | + |
| 61 | + // After |
| 62 | + const queue = new Queue(adapter, { |
| 63 | + name: "my-queue", |
| 64 | + pollInterval: 1000, // NEW |
| 65 | + }) |
| 66 | + |
| 67 | + // New timeout features |
| 68 | + await queue.add("long-job", payload, { timeout: false }) // Disable timeout |
| 69 | + await queue.add("quick-job", payload, { timeout: 5000 }) // 5 second timeout |
| 70 | + ``` |
| 71 | + |
| 72 | + **Database Migration Required:** |
| 73 | + - **Drizzle users**: Run migrations to add `timeout` column |
| 74 | + - **Prisma users**: Run `prisma db push` or `prisma migrate` to apply schema changes |
| 75 | + |
| 76 | + **Examples:** |
| 77 | + |
| 78 | + ```typescript |
| 79 | + // Disable timeout for long-running data processing |
| 80 | + await queue.add("process-large-dataset", data, { timeout: false }) |
| 81 | + |
| 82 | + // Set specific timeout for API calls |
| 83 | + await queue.add("external-api-call", params, { timeout: 30000 }) |
| 84 | + |
| 85 | + // Use default timeout (30 seconds) - no change needed |
| 86 | + await queue.add("normal-job", payload) |
| 87 | + ``` |
| 88 | + |
| 89 | + This release improves queue configuration clarity and provides flexible timeout control for different job types. |
| 90 | + |
| 91 | +### Patch Changes |
| 92 | + |
| 93 | +- Updated dependencies [ccaacc2] |
| 94 | +- Updated dependencies [5adb3a0] |
| 95 | + - @vorsteh-queue/core@0.3.0 |
| 96 | + |
3 | 97 | ## 0.2.0 |
4 | 98 |
|
5 | 99 | ### Minor Changes |
|
0 commit comments