From: APTX Date: Sat, 8 Jun 2013 22:21:40 +0000 (+0200) Subject: Add rule to notify new_pending_request on update. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=ec39bfa6119b9e2b0a2aaace3817ccc6ed6a3ee8;p=localmylist.git Add rule to notify new_pending_request on update. This notifies when a failed request can be retried. --- diff --git a/localmylist/share/schema/schema.sql b/localmylist/share/schema/schema.sql index 7910fb6..8891d19 100644 --- a/localmylist/share/schema/schema.sql +++ b/localmylist/share/schema/schema.sql @@ -327,6 +327,7 @@ CREATE OR REPLACE RULE file_location_ignore_duplicate AS ON INSERT TO file_locat CREATE OR REPLACE RULE file_location_insert_rename_rule AS ON INSERT TO file_location DO NOTIFY rename_data_changed; CREATE OR REPLACE RULE new_pending_request_rule AS ON INSERT TO pending_request DO NOTIFY new_pending_request; +CREATE OR REPLACE RULE pending_request_update_rule AS ON UPDATE TO pending_request WHERE new.start IS NULL AND new.failed IS NULL DO SELECT pg_notify('new_pending_request', ''); CREATE OR REPLACE RULE pending_request_ignore_duplicate AS ON INSERT TO pending_request WHERE (EXISTS (SELECT 1 FROM pending_request WHERE (((((pending_request.aid = new.aid) AND (pending_request.eid = new.eid)) AND (pending_request.fid = new.fid)) AND (pending_request.ed2k = new.ed2k)) AND (pending_request.size = new.size)))) DO INSTEAD NOTHING;