Commit f64fbce
feat: making product update sync to fb async (#3645)
Summary:
## Description
Adding schedule_product_sync that creates a transient job to sync product to commerce manager, and making it async to product update call on admin page & in turn much faster
Helper Function Summaries
-------------------------
**`store_sync_transient(int $product_id, array $sync_data): string`**
Creates a unique transient key and stores sync data with 300-second expiration for async processing.
**`process_sync_transient(string $transient_key): ?array`**
Validates transient key format, retrieves and deletes sync data, and restores $_POST context for processing.
**`handle_async_product_save(string $transient_key): void`**
Processes WordPress cron async calls by handling transient data and calling the main product save method with clean product ID.
### Type of change
Please delete options that are not relevant
- Add (non-breaking change which adds functionality)
## Checklist
- [yes] I have commented my code, particularly in hard-to-understand areas, if any.
- [yes] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [yes] I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
- [yes] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc)).
- [yes] I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
- [yes] I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
- [yes] I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this [wiki]([url](https://fburl.com/wiki/nhx73tgs)).
## Changelog entry
Making product update changes sync to commerce manager async
Pull Request resolved: #3645
Test Plan:
Updated a product and verified sync to commerce manager
Notice the difference in time for update to go through
### Before
https://pxl.cl/8gHrM
### After
https://pxl.cl/8gHrP
Reviewed By: vinkmeta
Differential Revision: D83573027
Pulled By: rithikb24
fbshipit-source-id: 7c20c9aab81bdff4261f4cc62b718427f303af421 parent 53a90f4 commit f64fbce
1 file changed
+102
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
312 | 315 | | |
313 | 316 | | |
314 | 317 | | |
| |||
348 | 351 | | |
349 | 352 | | |
350 | 353 | | |
351 | | - | |
| 354 | + | |
352 | 355 | | |
353 | 356 | | |
354 | 357 | | |
| |||
825 | 828 | | |
826 | 829 | | |
827 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
828 | 929 | | |
829 | 930 | | |
830 | 931 | | |
| |||
0 commit comments