Initial release
[websub-hub] / src / db / sqlite / sql / topic-content-fetch-claim-by-id.sql
diff --git a/src/db/sqlite/sql/topic-content-fetch-claim-by-id.sql b/src/db/sqlite/sql/topic-content-fetch-claim-by-id.sql
new file mode 100644 (file)
index 0000000..8b318ab
--- /dev/null
@@ -0,0 +1,8 @@
+-- claim a specific topic needing the content fetched
+INSERT INTO topic_fetch_in_progress (id, claimant, claimed, claim_expires)
+VALUES (:topicId, :claimant, strftime('%s', 'now'), strftime('%s', 'now') + :claimTimeoutSeconds)
+ON CONFLICT (id) DO UPDATE
+SET
+       claimant = :claimant,
+       claimed = strftime('%s', 'now'),
+       claim_expires = strftime('%s', 'now') + :claimTimeoutSeconds