Skip to content
Snippets Groups Projects
Commit 1246074d authored by Manuel Egío's avatar Manuel Egío Committed by Aaron Bauman
Browse files

Issue #3449163: last_delete_timestamp is saved to a future date when the cron runs every minute

parent adede34d
No related branches found
No related tags found
1 merge request!81Issue #3449163: last_delete_timestamp is saved to a future date when the cron runs every minute
Pipeline #451459 failed
...@@ -123,15 +123,17 @@ class DeleteHandler { ...@@ -123,15 +123,17 @@ class DeleteHandler {
$now = time(); $now = time();
// getDeleted() constraint: startDate must be at least one minute // getDeleted() constraint: startDate must be at least one minute
// greater than endDate. // greater than endDate.
$now = $now > $last_delete_sync + 60 ? $now : $now + 60; $now_sf = $now > $last_delete_sync + 60 ? $now : $now + 60;
// getDeleted() constraint: startDate cannot be more than 30 days ago. // getDeleted() constraint: startDate cannot be more than 30 days ago.
if ($last_delete_sync < strtotime('-29 days')) { if ($last_delete_sync < strtotime('-29 days')) {
$last_delete_sync = strtotime('-29 days'); $last_delete_sync = strtotime('-29 days');
} }
$last_delete_sync_sf = gmdate('Y-m-d\TH:i:s\Z', $last_delete_sync); $last_delete_sync_sf = gmdate('Y-m-d\TH:i:s\Z', $last_delete_sync);
$now_sf = gmdate('Y-m-d\TH:i:s\Z', $now); $now_sf = gmdate('Y-m-d\TH:i:s\Z', $now_sf);
$deleted = $this->sfapi->getDeleted($mapping->getSalesforceObjectType(), $last_delete_sync_sf, $now_sf); $deleted = $this->sfapi->getDeleted($mapping->getSalesforceObjectType(), $last_delete_sync_sf, $now_sf);
$this->handleDeletedRecords($deleted, $mapping->getSalesforceObjectType()); $this->handleDeletedRecords($deleted, $mapping->getSalesforceObjectType());
// We can't use $now_sf because it may have been adjusted to a future
// time and can cause the next pull to miss records.
$pull_info[$mapping->id()]['last_delete_timestamp'] = $now; $pull_info[$mapping->id()]['last_delete_timestamp'] = $now;
$this->state->set('salesforce.mapping_pull_info', $pull_info); $this->state->set('salesforce.mapping_pull_info', $pull_info);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment