alphagov / trade-tariff-backend

Enabling the population and distribution via API of UK Customs tariffs and duties
MIT License
7 stars 6 forks source link

Prevent sending more than 1 email per day #263

Closed theharq closed 8 years ago

theharq commented 8 years ago

What this PR does:

This is a workaround to have a flag that will be switch until the end of the day.

Currently calling these methods triggers an email, and since the sync process runs every hour an email is sent every hour.

This change takes advantage of the low level caching system to invalidate after certain amount of time.

We cannot persist the state of the email sent in the db because none of this cases are for a specific tariff update.