diff --git a/press/hooks.py b/press/hooks.py index 09aa1adc40..af6b0eabc5 100644 --- a/press/hooks.py +++ b/press/hooks.py @@ -182,7 +182,6 @@ "daily_long": [ "press.press.audit.check_bench_fields", "press.press.audit.check_offsite_backups", - "press.press.audit.check_backup_records", "press.press.audit.check_app_server_replica_benches", "press.press.doctype.invoice.invoice.finalize_unpaid_prepaid_credit_invoices", "press.press.doctype.bench.bench.sync_analytics", @@ -235,6 +234,9 @@ "press.press.doctype.site.backups.cleanup_offsite", "press.press.cleanup.unlink_remote_files_from_site", ], + "10 0 * * *": [ + "press.press.audit.check_backup_records", + ], "0 3 * * *": [ "press.press.doctype.drip_email.drip_email.send_drip_emails", ], diff --git a/press/press/audit.py b/press/press/audit.py index 372fe6d81d..39b64e8637 100644 --- a/press/press/audit.py +++ b/press/press/audit.py @@ -192,7 +192,7 @@ def get_sites_with_backup_in_interval(self, trial_plans: tuple[str]): WHERE site.status = "Active" and site_backup.owner = "Administrator" and - DATE(site_backup.creation) = "{self.yesterday}" + DATE(site_backup.creation) >= "{self.yesterday}" {cond_filters} """ ) @@ -225,7 +225,7 @@ def get_sites_activated_yesterday(self): for t in frappe.qb.from_(site_activites) .select(site_activites.site) .where(site_activites.action == "Activate Site") - .where(fn.Date(site_activites.creation) <= self.yesterday) + .where(fn.Date(site_activites.creation) >= self.yesterday) .run() ] ) diff --git a/press/press/doctype/virtual_disk_snapshot/virtual_disk_snapshot.py b/press/press/doctype/virtual_disk_snapshot/virtual_disk_snapshot.py index 5a220524f0..2ba94babf8 100644 --- a/press/press/doctype/virtual_disk_snapshot/virtual_disk_snapshot.py +++ b/press/press/doctype/virtual_disk_snapshot/virtual_disk_snapshot.py @@ -155,7 +155,7 @@ def delete_old_snapshots(): {"status": "Completed", "creation": ("<=", frappe.utils.add_days(None, -2))}, pluck="name", order_by="creation asc", - limit=50, + limit=500, ) for snapshot in snapshots: try: @@ -247,4 +247,5 @@ def _update_snapshot_if_exists(snapshot, random_snapshot): "status", random_snapshot.get_aws_status_map(snapshot["State"]), ) + return True return False