in salesforce_push.module
/**
* Implements hook_cron().
*/
function salesforce_push_cron() {
$sfapi = salesforce_get_api();
if (!$sfapi->isAuthorized()) {
return;
}
$queue = DrupalQueue::get(SALESFORCE_PUSH_QUEUE);
$limit = variable_get('salesforce_pull_limit', 50);
$use_soap = module_exists('salesforce_soap');
for ($delta = 0; ($item = $queue->claimItem()) && $delta < $limit; $delta++) {
$mapping = $item->data['mapping'];
// duplicate entity in the queue
if ($item->data['entity_type'] == $entity_type && $item->data['entity_id'] == $entity_id) {
$queue->deleteItem($item);
continue;
}
in
if ($item->data['entity_type'] == $entity_type && $item->data['entity_id'] == $entity_id)
$entity_type and $entity_id are not defined.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | salesforce-prevent_duplicate_processing_during_cron-1944138.patch | 1.44 KB | aaronbauman |
Comments
Comment #1
hazaThose variables are defined just below in the code. Here is a patch that move them just above the check.
Comment #2
kostajh commentedI see the problem that $entity_type and $entity_id are not defined, but with the patch in #1 that conditional check will always return true, right?
Comment #3
hazaOh ! Yes, you're right. I think I was really lacking sleep last week.
So, we really need to check against what we need to check those values.
Comment #4
adanielyan commentedIs there any update on this issue?
Comment #5
kostajh commented@levelos can you take a look at this? Not sure what was intended here.
Comment #6
aaronbaumanI believe the intention is to prevent duplicates during cron run.
The existing catch will only work if queue items are sorted sequentially by entity id.
A better mechanism is to explicitly track which entity ids have been processed.
See attached patch (which also solves issue of undefined variables)
Comment #7
aaronbaumanComment #8
tauno commentedApplied manually and committed with comments in d98c272. Thanks!
Comment #12
Deester4x4jr commentedThis doesn't seem to have been fixed. I'm running 7.x-3.0+17-dev and I am still getting this issue on salesforce_push.
I downgraded to 7.x-3.0 prod, and still am seeing issues. Made a small change, and the issue is now gone:
Comment #13
coatezy commentedI'm also experiencing this issue. Can this be reopened?