|
|
@ -66,7 +66,7 @@ def load_data(path): |
|
|
|
return DEFAULTS |
|
|
|
return DEFAULTS |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def save_data(path, data=None) |
|
|
|
def save_data(path, data=None): |
|
|
|
data = data or DEFAULTS |
|
|
|
data = data or DEFAULTS |
|
|
|
with open(path, 'w') as file_handle: |
|
|
|
with open(path, 'w') as file_handle: |
|
|
|
json.dump(data, file_handle) |
|
|
|
json.dump(data, file_handle) |
|
|
@ -121,7 +121,7 @@ def run(): |
|
|
|
|
|
|
|
|
|
|
|
ttl = data['time_to_live'] - 1 |
|
|
|
ttl = data['time_to_live'] - 1 |
|
|
|
if ttl <= 0: |
|
|
|
if ttl <= 0: |
|
|
|
data['email_sent'] = data['email_sent'] + 1 |
|
|
|
data['emails_sent'] = data['emails_sent'] + 1 |
|
|
|
data['time_to_live'] = GRACE_PERIOD * data['email_sent'] |
|
|
|
data['time_to_live'] = GRACE_PERIOD * data['email_sent'] |
|
|
|
save_data(DATA_STORE_PATH, data) |
|
|
|
save_data(DATA_STORE_PATH, data) |
|
|
|
send_alert_mail(data) |
|
|
|
send_alert_mail(data) |
|
|
|