Bumps vendored Oban Pro from 1.6.13 to 1.7.0, which transitively bumps oban core to 2.22.1 (requires migrations v14) and db_connection to 2.10.0. - mix.exs constraint: ~> 1.6 → ~> 1.7 - vendor/oban_pro/ replaced with v1.7.0 hex package - migration 20260430142200: Oban core v12 → v14 (must run first) - migration 20260430142241: Oban Pro 1.7.0 schema additions Also corrects a pre-existing constraint name in AgentAssignment that was left stale by the equipment→devices rename migration (20260117190134). The unique index is named agent_assignments_device_id_index, but the schema's unique_constraint/3 still pointed at the old equipment_id name, causing the test suite to surface Ecto.ConstraintError instead of a changeset error. Required to get the suite green for this upgrade.
34 lines
881 B
Markdown
34 lines
881 B
Markdown
# Chunks
|
|
|
|
Chunks process jobs in groups based on size or timeout. Use for bulk operations and batched API calls.
|
|
|
|
```elixir
|
|
defmodule MyApp.BulkIndexer do
|
|
use Oban.Pro.Chunk, size: 100, timeout: 5_000
|
|
|
|
@impl true
|
|
def process([_ | _] = jobs) do
|
|
jobs
|
|
|> Enum.map(& &1.args["document"])
|
|
|> MyApp.Search.bulk_index()
|
|
|
|
:ok
|
|
end
|
|
end
|
|
```
|
|
|
|
## Options
|
|
|
|
- `size: 100` — process up to 100 jobs at once (default)
|
|
- `timeout: 1000` — process after 1 second even if size not reached (default)
|
|
- `by: [args: :tenant_id]` — partition chunks by field
|
|
|
|
## Return values
|
|
|
|
```elixir
|
|
:ok # All jobs succeeded
|
|
{:ok, result} # All jobs succeeded with result
|
|
{:error, reason, failed_jobs} # Some jobs failed, others succeed
|
|
{:cancel, reason, jobs} # Cancel specific jobs
|
|
{:snooze, seconds, jobs} # Snooze specific jobs
|
|
```
|