Skip to content

Conversation

@rithikb24
Copy link
Contributor

@rithikb24 rithikb24 commented Oct 27, 2025

Description

Overall: Added manual_sync_timestamp parameter throughout the product sync pipeline to accurately track when manual full syncs are initiated. This timestamp is captured
at sync start and passed through to the external_update_time field, fixing latency sampling issues where product modification times were incorrectly used instead of
actual sync initiation times.


Changes by File

includes/AJAX.php

  • Capture time() when manual sync is initiated via AJAX
  • Pass timestamp to create_or_update_all_products()

includes/Products/Sync.php

  • Added $manual_sync_timestamp property
  • Store timestamp in constructor parameter
  • Include timestamp in background job data when scheduling sync

includes/Products/Sync/Background.php

  • Extract manual_sync_timestamp from job data
  • Pass timestamp to prepare_product() for each product

includes/fbproduct.php

  • Added $manual_sync_timestamp parameter to prepare_product()
  • Use manual timestamp for external_update_time when provided
  • Fall back to product's date_modified if no manual timestamp

includes/fbutils.php

  • Added $manual_sync_timestamp parameter to batch preparation functions
  • Pass timestamp through to prepare_product() calls

tests/Unit/fbproductTest.php

  • No functional changes (tests continue to work with optional parameter)

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.
  • [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.

Changelog entry

Added manual_sync_timestamp parameter throughout product sync pipeline (AJAX → Sync → Background → fbproduct) to use sync initiation time instead of product
modification time for external_update_time, fixing latency sampling issues in manual full syncs.

Test Plan

  • Did a full sync from troubleshooting page and verified logs
  • Verified all other syncing related flows external_update_value is unchanged

@meta-cla meta-cla bot added the CLA Signed label Oct 27, 2025
@rithikb24 rithikb24 added the changelog: add A new feature, function, or functionality was added. label Oct 27, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 27, 2025

📦 Latest Plugin Build

Built at: 2025-10-31T14:39:03.683Z
Commit: 92396f6
Size: 1.4M

Download: Click here to download the plugin

To download: Click the link above → Scroll to bottom → Download "facebook-for-woocommerce" artifact

@rithikb24 rithikb24 marked this pull request as ready for review October 27, 2025 17:25
@meta-codesync
Copy link

meta-codesync bot commented Oct 27, 2025

@rithikb24 has imported this pull request. If you are a Meta employee, you can view this in D85580987.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: add A new feature, function, or functionality was added. CLA Signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants