Skip to content

Commit

Permalink
Updated comments and moved crons to run when load is low
Browse files Browse the repository at this point in the history
  • Loading branch information
acasajus committed Aug 2, 2023
1 parent 6e7b2f4 commit 0846d51
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 45 deletions.
18 changes: 2 additions & 16 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@ def create(cls, **kw):
flush = kw.pop("flush", False)

# make sure email is lowercase and doesn't have any whitespace
website_email = sanitize_email(kw["website_email"]).replace("\u200f", "")
website_email = sanitize_email(kw["website_email"])
kw["website_email"] = website_email
if "reply_email" in kw:
kw["reply_email"] = normalize_reply_email(sanitize_email(kw["reply_email"]))
Expand Down Expand Up @@ -2609,23 +2609,9 @@ def aliases(self) -> [Alias]:

@classmethod
def create(cls, **kw):
# whether to call Session.commit
commit = kw.pop("commit", False)
flush = kw.pop("flush", False)

if "email" in kw:
kw["email"] = sanitize_email(kw["email"])

r = cls(**kw)
Session.add(r)

if commit:
Session.commit()

if flush:
Session.flush()

return r
return super().create(**kw)

def __repr__(self):
return f"<Mailbox {self.id} {self.email}>"
Expand Down
2 changes: 1 addition & 1 deletion app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def sanitize_email(email_address: str, not_lower=False) -> str:
email_address = email_address.strip().replace(" ", "").replace("\n", " ")
if not not_lower:
email_address = email_address.lower()
return email_address
return email_address.replace("\u200f", "")


class NextUrlSanitizer:
Expand Down
58 changes: 30 additions & 28 deletions crontab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,66 @@ jobs:
- name: SimpleLogin growth stats
command: python /code/cron.py -j stats
shell: /bin/bash
schedule: "0 0 * * *"
schedule: "15 0 * * *"
captureStderr: true

- name: SimpleLogin Notify Trial Ends
command: python /code/cron.py -j notify_trial_end
- name: SimpleLogin Delete Old Monitoring records
command: python /code/cron.py -j delete_old_monitoring
shell: /bin/bash
schedule: "0 8 * * *"
schedule: "15 1 * * *"
captureStderr: true

- name: SimpleLogin Notify Manual Subscription Ends
command: python /code/cron.py -j notify_manual_subscription_end
- name: SimpleLogin Custom Domain check
command: python /code/cron.py -j check_custom_domain
shell: /bin/bash
schedule: "0 9 * * *"
schedule: "15 2 * * *"
captureStderr: true

- name: SimpleLogin Notify Premium Ends
command: python /code/cron.py -j notify_premium_end
- name: SimpleLogin HIBP check
command: python /code/cron.py -j check_hibp
shell: /bin/bash
schedule: "0 10 * * *"
schedule: "15 3 * * *"
captureStderr: true
concurrencyPolicy: Forbid

- name: SimpleLogin Notify HIBP breaches
command: python /code/cron.py -j notify_hibp
shell: /bin/bash
schedule: "15 4 * * *"
captureStderr: true
concurrencyPolicy: Forbid

- name: SimpleLogin Delete Logs
command: python /code/cron.py -j delete_logs
shell: /bin/bash
schedule: "0 11 * * *"
schedule: "15 5 * * *"
captureStderr: true

- name: SimpleLogin Poll Apple Subscriptions
command: python /code/cron.py -j poll_apple_subscription
shell: /bin/bash
schedule: "0 12 * * *"
schedule: "15 6 * * *"
captureStderr: true

- name: SimpleLogin Delete Old Monitoring records
command: python /code/cron.py -j delete_old_monitoring
- name: SimpleLogin Notify Trial Ends
command: python /code/cron.py -j notify_trial_end
shell: /bin/bash
schedule: "0 14 * * *"
schedule: "15 8 * * *"
captureStderr: true

- name: SimpleLogin Custom Domain check
command: python /code/cron.py -j check_custom_domain
- name: SimpleLogin Notify Manual Subscription Ends
command: python /code/cron.py -j notify_manual_subscription_end
shell: /bin/bash
schedule: "0 15 * * *"
schedule: "15 9 * * *"
captureStderr: true

- name: SimpleLogin HIBP check
command: python /code/cron.py -j check_hibp
- name: SimpleLogin Notify Premium Ends
command: python /code/cron.py -j notify_premium_end
shell: /bin/bash
schedule: "0 18 * * *"
schedule: "15 10 * * *"
captureStderr: true
concurrencyPolicy: Forbid

- name: SimpleLogin Notify HIBP breaches
command: python /code/cron.py -j notify_hibp
shell: /bin/bash
schedule: "0 19 * * *"
captureStderr: true
concurrencyPolicy: Forbid


- name: SimpleLogin send unsent emails
command: python /code/cron.py -j send_undelivered_mails
Expand Down

0 comments on commit 0846d51

Please sign in to comment.