about summary refs log tree commit diff
path: root/kittybox-rs/migrations
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-07-09 18:25:58 +0300
committerVika <vika@fireburn.ru>2023-07-09 18:25:58 +0300
commitca422132c8f739f3ee873046a3f59d80f2462152 (patch)
tree2eecdd714d94481e1131f52626553a93a69cfe95 /kittybox-rs/migrations
parent9ce77c472bef59918d14b52af1332e454516e486 (diff)
downloadkittybox-ca422132c8f739f3ee873046a3f59d80f2462152.tar.zst
webmentions/queue: give up on an item after 5 attempts
This also involves a crude "async drop" implementation that fires a
future incrementing an attempt if a Job has been dropped without
marking it as done.
Diffstat (limited to 'kittybox-rs/migrations')
-rw-r--r--kittybox-rs/migrations/0002_webmention_queue.sql9
1 files changed, 6 insertions, 3 deletions
diff --git a/kittybox-rs/migrations/0002_webmention_queue.sql b/kittybox-rs/migrations/0002_webmention_queue.sql
index 0b95771..708933b 100644
--- a/kittybox-rs/migrations/0002_webmention_queue.sql
+++ b/kittybox-rs/migrations/0002_webmention_queue.sql
@@ -1,10 +1,13 @@
-CREATE TABLE incoming_webmention_queue (
+CREATE TABLE kittybox.incoming_webmention_queue (
        id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
        source TEXT NOT NULL,
        target TEXT NOT NULL,
-       recv_timestamp TIMESTAMPTZ NOT NULL DEFAULT now()
+       recv_timestamp TIMESTAMPTZ NOT NULL DEFAULT now(),
+       attempts INTEGER NOT NULL DEFAULT 0
 );
 
+CREATE INDEX webmention_jobs_by_attempts ON kittybox.incoming_webmention_queue (attempts);
+
 CREATE RULE notify_incoming_webmention AS
-ON INSERT TO incoming_webmention_queue
+ON INSERT TO kittybox.incoming_webmention_queue
 DO ALSO NOTIFY incoming_webmention;