feat(v1.1.9): TriggerEvent::Queue + TriggerKind::Queue + types
Add the data-shape pieces for v1.1.9's queue surface; behavior lands in later commits. Each piece compiles independently. - shared/trigger_event.rs: TriggerEvent::Queue variant (queue_name, message, enqueued_at, attempt, message_id). source() returns "queue". Surfaced to scripts as ctx.event.queue with op = "receive". - manager-core/trigger_repo.rs: TriggerKind::Queue + TriggerDetails::Queue + CreateQueueTrigger + ActiveQueueConsumer + QueueDetailRow + QueueConsumerRow. PostgresTriggerRepo gains create_queue_trigger (advisory-lock-then-SELECT enforces one-consumer-per-queue), list_active_queue_consumers (dispatcher scan), touch_queue_trigger_last_fired_at. hydrate_one hydrates the Queue arm. - manager-core/outbox_repo.rs: OutboxSourceKind::Invoke for invoke_async() outbox rows. - manager-core/dispatcher.rs: placeholder OutboxSourceKind::Invoke arm (logs + drops the row) so the workspace compiles; real arm lands in commit 10. - manager-core/trigger_config.rs: queue_reclaim_interval_ms (30000) + queue_default_visibility_timeout_secs (30) env-overridable knobs. - executor-core/engine.rs: trigger_event_to_dynamic handles Queue → builds ctx.event.queue map. - manager-core/triggers_api.rs: in-memory mock TriggerRepo gains the three new methods (returns Default-ish values for tests). Unit tests: TriggerEvent::Queue serde round-trip, TriggerKind::Queue wire round-trip, advisory_lock_key stability per (app_id, queue_name) pair. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,18 @@ pub struct TriggerConfig {
|
||||
/// real-world cron precision is per-minute, so a 30s tick is fine.
|
||||
/// Floored at 1s by the scheduler.
|
||||
pub cron_tick_interval_ms: u32,
|
||||
|
||||
/// Queue visibility-timeout reclaim task cadence, in ms (v1.1.9).
|
||||
/// Default 30 000. The reclaim task clears claims on
|
||||
/// `queue_messages` whose `claimed_at` exceeds the per-queue
|
||||
/// `visibility_timeout_secs`, so a crashed consumer doesn't lose
|
||||
/// the message.
|
||||
pub queue_reclaim_interval_ms: u32,
|
||||
|
||||
/// Default per-queue visibility-timeout in seconds (v1.1.9). Used
|
||||
/// at queue-trigger creation when the request omits an explicit
|
||||
/// value. Default 30. The per-trigger column overrides this.
|
||||
pub queue_default_visibility_timeout_secs: u32,
|
||||
}
|
||||
|
||||
impl TriggerConfig {
|
||||
@@ -75,6 +87,8 @@ impl TriggerConfig {
|
||||
dead_letter_retention_days: 30,
|
||||
abandoned_retention_days: 7,
|
||||
cron_tick_interval_ms: 30_000,
|
||||
queue_reclaim_interval_ms: 30_000,
|
||||
queue_default_visibility_timeout_secs: 30,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +115,14 @@ impl TriggerConfig {
|
||||
&mut c.cron_tick_interval_ms,
|
||||
"PICLOUD_CRON_TICK_INTERVAL_MS",
|
||||
);
|
||||
load_u32(
|
||||
&mut c.queue_reclaim_interval_ms,
|
||||
"PICLOUD_QUEUE_RECLAIM_INTERVAL_MS",
|
||||
);
|
||||
load_u32(
|
||||
&mut c.queue_default_visibility_timeout_secs,
|
||||
"PICLOUD_QUEUE_DEFAULT_VISIBILITY_TIMEOUT_SECS",
|
||||
);
|
||||
c
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user