Rate-limiting Blocks Discourse Workflow

Good news for part of your problem at least:

The reason can now be attributed in the workflow. The bad news I think the reason field has to be a valid post ID or url. I don’t think there would be much from a group-join api json that would be a valid topic/post there.

Could you instead use sql query to quickly identify who in the group needs the badge (in group and not possessing badge)…then gives it to them.

Data Explorer plugin required:

-- [params]
-- string :group_name = members_uber_group
-- string :badge_name = badge_to_award

SELECT
  u.id AS user_id,
  u.username,
  u.name
FROM users u
JOIN group_users gu ON gu.user_id = u.id
JOIN groups g ON g.id = gu.group_id
WHERE g.name = :group_name
  AND u.id > 0
  AND u.staged IS FALSE
  AND NOT EXISTS (
    SELECT 1
    FROM user_badges ub
    JOIN badges b ON b.id = ub.badge_id
    WHERE ub.user_id = u.id
      AND b.badge_type_id = 3  -- bronze
      AND b.name ILIKE '%' || :badge_name || '%'
  )
ORDER BY u.username

group-members-missing-a-bronze-badge.dcquery.json (1.4 KB)

Workflow:

If it really needs to be timely, then run every few minutes. The sql query is relatively lightweight. According to the AI that authored the workflow, the Grant Badge runs individually on each listed username fed by the Data Explorer Query node.

לייק 1