mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-19 15:50:25 -06:00
* initial pass on stateful intervals * pr review comments + add evict expired idempotency keys * fix: goroutine leak and name vars better * fix some cleanup logic
33 lines
660 B
SQL
33 lines
660 B
SQL
-- name: ListIntervalsByOperationId :many
|
|
SELECT
|
|
*
|
|
FROM
|
|
v1_operation_interval_settings
|
|
WHERE
|
|
operation_id = @operationId::text;
|
|
|
|
-- name: UpsertInterval :one
|
|
INSERT INTO v1_operation_interval_settings (
|
|
tenant_id,
|
|
operation_id,
|
|
interval_nanoseconds
|
|
) VALUES (
|
|
@tenantId::uuid,
|
|
@operationId::text,
|
|
@intervalNanoseconds::bigint
|
|
) ON CONFLICT (tenant_id, operation_id) DO UPDATE
|
|
SET
|
|
interval_nanoseconds = EXCLUDED.interval_nanoseconds
|
|
RETURNING
|
|
*;
|
|
|
|
-- name: ReadInterval :one
|
|
SELECT
|
|
*
|
|
FROM
|
|
v1_operation_interval_settings
|
|
WHERE
|
|
tenant_id = @tenantId::uuid
|
|
AND operation_id = @operationId::text
|
|
LIMIT 1;
|