Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: send action payloads on pg notify #1033

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions views/018_playbooks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
CREATE OR REPLACE FUNCTION notify_playbook_action_update() RETURNS TRIGGER AS $$
BEGIN
IF TG_OP = 'INSERT' THEN
NOTIFY playbook_action_updates;
PERFORM pg_notify('playbook_action_updates', json_build_object('id', NEW.id, 'agent_id', NEW.agent_id)::TEXT);
ELSEIF TG_OP = 'UPDATE' THEN
IF OLD.status != NEW.status AND NEW.status = 'scheduled' THEN
NOTIFY playbook_action_updates;
PERFORM pg_notify('playbook_action_updates', json_build_object('id', NEW.id, 'agent_id', NEW.agent_id)::TEXT);
END IF;
END IF;

Expand Down
Loading