Action triggers repeat_delay looking at unrelated events

Bug #1823983 reported by Steve Callender
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
3.6
Fix Released
Medium
Unassigned

Bug Description

Tested in Evergreen 3.1

I'm seeing events blocked from being created if there is a repeat_delay but a different event falls into that window and the events share the same target ID.

I've been testing with the Expiration Courtesy Notices.

event def 110
Hook au.expired (or expired on early setups)
repeat_delay 300 days

This should fire off if there no no 110 events in the last 300 days, and there isn't.

However, there is a single event from 3 months ago for a different trigger,

event def 32
hook biblio.format.record_entry.print

So it looks like Evergreen needs to not just find events with a matching target, but also limit them to the event definition as well.

It looks like it only cares about the target value,

open-ils.cstore.direct.actor.user.id_list.atomic [{"active":"t","home_ou":{"in":{"from":"aou","where":{"id":2},"select":{"aou":[{"transform":"actor.org_unit_descendants","result_field":"id","column":"id"}]}}},"deleted":"f","-and":[{"+atev":{"id":null}}],"expire_date":{"between":["2019-03-06 10:05:03+0000","2019-04-05 10:05:03+0000"]}},{"join":{"atev":{"filter":{"start_time":{">":"2018-05-09 10:05:03+0000"}},"fkey":"id","field":"target","type":"left"}}}]

Revision history for this message
Mike Rylander (mrylander) wrote :

This turns out to be a very straight-forward fix. Branch here:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/miker/lp-1823983-keep_event_id_filter_on_delay_repeat_check

From the commit message:

This bug has existed since the repeat_delay feature was added, but likely only rarely was triggered because most events don't have a repeat_delay, and those that do don't interact with the same target. However, as more repeatable event definitions are created, inappropriate interaction becomes more likely.

In this commit we avoid overwriting the whole join condition clause, which already contains an event definition id filter and needs to retain it.

Included is an unrelated change that uses the new-ish form of interval_to_seconds that avoids DST boundary shifting issues by passing a context DateTime object as the second parameter.

Changed in evergreen:
status: New → Confirmed
milestone: none → 3.3.1
milestone: 3.3.1 → none
tags: added: actiontrigger pullrequest
Changed in evergreen:
importance: Undecided → Medium
milestone: none → 3.4.3
Changed in evergreen:
milestone: 3.4.3 → 3.4.4
Changed in evergreen:
milestone: 3.4.4 → 3.5.1
Changed in evergreen:
milestone: 3.5.1 → 3.5.2
Changed in evergreen:
milestone: 3.5.2 → 3.6.1
Changed in evergreen:
milestone: 3.6.1 → 3.6.2
Changed in evergreen:
milestone: 3.6.2 → 3.6.3
Changed in evergreen:
milestone: 3.6.3 → 3.6.4
Changed in evergreen:
milestone: 3.6.4 → 3.7.2
Revision history for this message
Galen Charlton (gmc) wrote :

Signoff branch available at user/gmcharlt/lp1823983_signoff. We have been using this in production for over two years.

tags: added: signedoff
Revision history for this message
Galen Charlton (gmc) wrote :

And as ample time has passed, I've pushed this to master, rel_3_7, and rel_3_6. Thanks, Mike!

no longer affects: evergreen/3.5
no longer affects: evergreen/3.4
no longer affects: evergreen/3.3
Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
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.