Initial release
[websub-hub] / src / db / postgres / sql / subscription-delivery-claim-by-id.sql
diff --git a/src/db/postgres/sql/subscription-delivery-claim-by-id.sql b/src/db/postgres/sql/subscription-delivery-claim-by-id.sql
new file mode 100644 (file)
index 0000000..3295dc8
--- /dev/null
@@ -0,0 +1,9 @@
+--
+INSERT INTO subscription_delivery_in_progress (id, claimant, claimed, claim_expires)
+VALUES ($(subscriptionId), $(claimant), now(), now() + $(claimTimeoutSeconds)::text::interval)
+ON CONFLICT (id) DO UPDATE
+SET
+       claimant = $(claimant),
+       claimed = now(),
+       claim_expires = now() + $(claimTimeoutSeconds)::text::interval
+RETURNING id