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

Change expiry_soon_days and expiry_critical_days #662

Closed
hyanwong opened this issue Apr 23, 2023 · 3 comments
Closed

Change expiry_soon_days and expiry_critical_days #662

hyanwong opened this issue Apr 23, 2023 · 3 comments

Comments

@hyanwong
Copy link
Member

hyanwong commented Apr 23, 2023

We decided that expiry_soon_days should default to 30 and expiry_critical_days should default to 1015. They need setting here:

out['expiry_soon_days'] = 90

When doing this, is there any constraint on what we should set expiry_hysteresis to, @lentinj ?

It's not critical to do this now, because we will override it on the server using appconfig.ini, but it would avoid confusion to change the defaults in the code to what we expect.

@lentinj
Copy link
Collaborator

lentinj commented Apr 23, 2023

Beyond the obvious "make sure the regions don't overlap as a result", I don't think so. What they actually do is:

expiry_soon_date = sponsorship_expiry_soon_date()
expiry_soon_trigger = expiry_soon_date - datetime.timedelta(days=sponsorship_config()['expiry_hysteresis'])
expiry_critical_date = sponsorship_expiry_soon_date('critical')
expiry_critical_trigger = expiry_critical_date - datetime.timedelta(days=sponsorship_config()['expiry_hysteresis'])

The first date decides that they appear in an e-mail, the second triggers the e-mail to actually be sent (and thus batching the 10 days' worth of alerts).

@hyanwong
Copy link
Member Author

hyanwong commented Apr 23, 2023

Also it would be good to add a comment with a little more explanation of the expiry_hysteresis value, e.g. using a practical example, as it's not obvious ATM. E.g.

"If expiry_soon_days is 30 and expiry_hysteresis=5, then when the script is run anything exciting between 30 and 25 days will be considered as expiring soon". Is that correct @lentinj ?

@lentinj
Copy link
Collaborator

lentinj commented Apr 23, 2023

"If expiry_soon_days is 30 and expiry_hysteresis=5, then an e-mail will be sent when any sponsorship has 25 days left. This e-mail will include any other sponsorships with 25..30 days left - these won't get a separate e-mail once they hit 25 days left.".

hyanwong added a commit to hyanwong/OZtree that referenced this issue Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants