fix(signup): Restore orphaned standby site#6507
Conversation
|
| Filename | Overview |
|---|---|
| press/saas/doctype/product_trial/product_trial.py | Adds restore_orphaned_standby_sites called from create_standby_sites_in_each_cluster; the orphan query lacks a limit, and the restoration logic carries a residual (previously noted) race window between the is_standby=0 commit and the subsequent site.save(). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[replenish_standby_sites scheduler] --> B[get all products with pooling enabled]
B --> C[for each product: create_standby_sites_in_each_cluster]
C --> D{enable_pooling?}
D -- No --> Z[return]
D -- Yes --> E[restore_orphaned_standby_sites]
E --> F[get administrator_team]
F --> G{team found?}
G -- No --> H[return early]
G -- Yes --> I[query orphaned sites\nis_standby=0, team=admin,\naccount_request IS NULL,\nsignup_time IS NULL,\nmodified < now-15min]
I --> J{orphans found?}
J -- No --> K[skip]
J -- Yes --> L[set_value is_standby=1 for all orphans]
L --> M[frappe.db.commit]
K --> N[get_available_clusters]
M --> N
N --> O[for each cluster: create_standby_sites]
O --> P{success?}
P -- Yes --> Q[frappe.db.commit]
P -- No --> R[log_error + frappe.db.rollback]
Q --> S[next cluster]
R --> S
Reviews (3): Last reviewed commit: "Merge branch 'develop' into restore_orph..." | Re-trigger Greptile
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (10.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #6507 +/- ##
===========================================
- Coverage 50.13% 50.12% -0.01%
===========================================
Files 956 956
Lines 79331 79341 +10
Branches 377 375 -2
===========================================
- Hits 39771 39770 -1
- Misses 39532 39543 +11
Partials 28 28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
related to PR: #6470
The initial commit in the standby site state wont be rolled back if the error occurs out of the try except block scope. This sites will be orphaned even though they are still good to use. So during replenish, if we find sites that are orphaned, we restore them back to pool.