Action Trigger for new user creation - Change hook to active

Bug #1705333 reported by Josh Stompro
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Evergreen
Confirmed
Medium
Unassigned
3.11
Confirmed
Medium
Unassigned

Bug Description

This is a follow up to bug 1392396, which added an action trigger setup for sending out a new user welcome message.

As it was commited it used an passive hook that queried the actor.usr table for new accounts since a certain date.

Bill Erickson mentioned in a comment after the fix was created that there is an active hook for au.create available.

I would like to switch the setup of that feature over to using the active hook for correctness. For our goal of sending out welcome emails as soon as possible after account creation, the active hook seems like a better design, since we wouldn't be searching the actor.usr table constantly for new accounts.

Josh

tags: added: actiontrigger
Changed in evergreen:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Jessica Woolford (jwoolford) wrote :

I am working with a library now who wants these messages sent only once every 3 days. So if we could choose between the passive and the active hook, that would be ideal.

Revision history for this message
Bill Erickson (berick) wrote :

Jessica, you can still chose to "fire" the events at any time (e.g. every 3 days), regardless of active vs. passive.

Revision history for this message
Steve Callender (stevecallender) wrote :

What I am seeing is that due to the au.created hook automatically firing off in the "update_patron" routine in OpenILS/Application/Actor.pm, that the delay on the trigger is completely ignored and a notice is created no matter what with no regard to the delay setting (the notice is created with a run_time as now() ). I believe it's because the trigger is marked as "passive".

So the quick fix here, and what I beleive is the correct thing to do, is to just change the trigger from passive to not in the database.

update action_trigger.hook set passive =false where key='au.created';

The catch here however, is that if folks have been relying on a "passive" trigger to go out and create notices after their repeat_delay threshold, it will no longer do that since it will rely on creating the notice at new user time, rather than going out and finding existing ones.

Revision history for this message
Bill Erickson (berick) wrote :

Looks like update_patron() creates the events, but I suspect the A/T runner is scooping them up and firing them shortly after they are created.

Applying a granularity to the event def with a matching A/T runner invocation should give full control of the timing of the firing.

Agreed setting the existing hook to active is the correct thing, since the code actively creates the events.

I think a migration strategy could be 1) set hook to active, 2) apply granularity to the affected event defs, 3) supply sample CRON A/T runner entry in the upgrade notes that leverages the new granularity.

Revision history for this message
Terran McCanna (tmccanna) wrote :

Noting that we're running into this as well since we're trying to send out a new user followup message two weeks after our original welcome notice.

Is there any use case for why au.create should remain passive?

Revision history for this message
Chris Sharp (chrissharp123) wrote :

Branch implementing Bill's suggestion here:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/csharp/lp1705333_au_created_passive_setting

Tested so far against a PINES-ish 3.10 server.

Changed in evergreen:
milestone: none → 3.11.1
tags: added: pullrequest
Changed in evergreen:
milestone: 3.11.1 → 3.12-beta
Revision history for this message
Terran McCanna (tmccanna) wrote :

We've had this in production in PINES for more than a month now and everything seems to be working fine.

Changed in evergreen:
assignee: nobody → Jessica Woolford (jwoolford)
Revision history for this message
Jessica Woolford (jwoolford) wrote (last edit ):

Here is a sign-off branch that includes a check to see if the hook is already active, and skips the update if it is:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/jwoolford/lp1705333_au_created_passive_setting_with_check

Bibliomation's hook is already active, and we have a different granularity set, so we wouldn't want the script to override that.

Not adding a sign-off tag just yet because IF THEN ELSE statements in SQL are new to me, so I'd appreciate a more experienced eyes on it.

Editing to add this has been tested on a 3.9 database with Bibliomation data, and seems to do the job in both scenarios (skip the UPDATE queries if hook is already active, and run the UPDATE queries if not).

Changed in evergreen:
assignee: Jessica Woolford (jwoolford) → nobody
tags: added: signedoff
Revision history for this message
Terran McCanna (tmccanna) wrote :

Adding back needswork because when I ran the included upgrade script I got:

ERROR: syntax error at or near "\"
LINE 15: \qecho

tags: added: needswork
removed: pullrequest signedoff
Revision history for this message
Terran McCanna (tmccanna) wrote :

Removing milestones for now since it needs a little work.

Changed in evergreen:
milestone: 3.12-beta → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.