mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-04-20 08:42:45 -05:00
Fix: Scheduled runs race w/ idempotency key check (#2077)
* feat: create table for storing key * feat: is_filled col * feat: idempotency repo * fix: handle filling * fix: improve queries * feat: check if was created already before triggering * fix: handle partitions * feat: improve schema * feat: initial idempotency key claiming impl * fix: db * fix: sql fmt * feat: crazy query * fix: downstream * fix: queries * fix: query bug * fix: migration rename * fix: couple small issues * feat: eviction job * fix: copilot comments * fix: index name * fix: rm comment
This commit is contained in:
@@ -1628,3 +1628,19 @@ CREATE TABLE v1_durable_sleep (
|
||||
sleep_duration TEXT NOT NULL,
|
||||
PRIMARY KEY (tenant_id, sleep_until, id)
|
||||
);
|
||||
|
||||
CREATE TABLE v1_idempotency_key (
|
||||
tenant_id UUID NOT NULL,
|
||||
|
||||
key TEXT NOT NULL,
|
||||
|
||||
expires_at TIMESTAMPTZ NOT NULL,
|
||||
claimed_by_external_id UUID,
|
||||
|
||||
inserted_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
PRIMARY KEY (tenant_id, expires_at, key)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX v1_idempotency_key_unique_tenant_key ON v1_idempotency_key (tenant_id, key);
|
||||
|
||||
Reference in New Issue
Block a user