1 -- claim a specific topic needing the content fetched
2 INSERT INTO topic_fetch_in_progress (id, claimant
, claimed
, claim_expires
)
3 VALUES ($
(topicId
), $
(claimant
), now(), now() + $
(claimTimeoutSeconds
)::text::interval)
4 ON CONFLICT (id) DO UPDATE
6 claimant
= $
(claimant
),
8 claim_expires
= now() + $
(claimTimeoutSeconds
)::text::interval
9 WHERE topic_fetch_in_progress.claim_expires
< now()