Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
salesforce-3257058
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
salesforce-3257058
Commits
f6ac7e36
Commit
f6ac7e36
authored
6 years ago
by
Gabriel Carleton-Barnes
Committed by
Aaron Bauman
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2941211
by gcb, aaronbauman: Overwhelmed Pull Queue is permanent because Cron times out
parent
d23a71e5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/salesforce_pull/salesforce_pull.drush.inc
+32
-2
32 additions, 2 deletions
modules/salesforce_pull/salesforce_pull.drush.inc
modules/salesforce_pull/src/QueueHandler.php
+7
-3
7 additions, 3 deletions
modules/salesforce_pull/src/QueueHandler.php
with
39 additions
and
5 deletions
modules/salesforce_pull/salesforce_pull.drush.inc
+
32
−
2
View file @
f6ac7e36
...
...
@@ -66,6 +66,23 @@ function salesforce_pull_drush_command() {
],
];
$items
[
'sf-pull-set'
]
=
[
'category'
=>
'salesforce'
,
'description'
=>
'Set pull timestamp on a single Salesforce Mappings to a specific point in history (or now).'
,
'arguments'
=>
[
'name'
=>
[
'description'
=>
'Machine name of the Salesforce Mapping for which to reset pull timestamps.'
,
],
'time'
=>
[
'description'
=>
'Timestamp to set the value to. Defaults to the runtime.'
,
],
],
'examples'
=>
[
'drush sf-pull-set foo'
=>
'Set pull timestamps for mapping "foo" to "now"'
,
'drush sf-pull-set foo 1517416761'
=>
'Set pull timestamps for mapping "foo" to Jan 31, 2018, around 8:40am time in Portland, OR'
,
],
];
return
$items
;
}
...
...
@@ -169,7 +186,7 @@ function drush_salesforce_pull_sf_pull_file($file, $name = NULL) {
$sfids
=
[];
foreach
(
$chunk
as
$j
=>
$row
)
{
if
(
empty
(
$row
)
||
empty
(
$row
[
0
]))
{
drush_log
(
dt
(
'Skipping row !n, no SFID found.'
,
[
'!n'
=>
$base
+
$j
+
1
]),
'warning'
);
drush_log
(
dt
(
'Skipping row !n, no SFID found.'
,
[
'!n'
=>
$base
$j
1
]),
'warning'
);
continue
;
}
try
{
...
...
@@ -182,7 +199,7 @@ function drush_salesforce_pull_sf_pull_file($file, $name = NULL) {
}
}
catch
(
\Exception
$e
)
{
drush_log
(
dt
(
'Skipping row !n, no SFID found.'
,
[
'!n'
=>
$base
+
$j
+
1
]),
'warning'
);
drush_log
(
dt
(
'Skipping row !n, no SFID found.'
,
[
'!n'
=>
$base
$j
1
]),
'warning'
);
continue
;
}
$sfid
=
(
string
)
$sfid
;
...
...
@@ -260,3 +277,16 @@ function drush_salesforce_pull_sf_pull_reset($name = NULL) {
->
setForcePull
(
$mapping
);
}
}
function
drush_salesforce_pull_sf_pull_set
(
$name
,
$time
=
NULL
)
{
if
(
is_null
(
$time
))
{
$time
=
time
();
}
$mapping
=
_salesforce_drush_get_mapping
(
$name
);
if
(
$mapping
)
{
$mapping
->
setLastPullTime
(
$time
);
\Drupal
::
entityTypeManager
()
->
getStorage
(
'salesforce_mapped_object'
)
->
setForcePull
(
$mapping
);
}
}
This diff is collapsed.
Click to expand it.
modules/salesforce_pull/src/QueueHandler.php
+
7
−
3
View file @
f6ac7e36
...
...
@@ -146,9 +146,6 @@ class QueueHandler {
$results
=
$this
->
doSfoQuery
(
$mapping
,
[],
$start
,
$stop
);
if
(
$results
)
{
$this
->
enqueueAllResults
(
$mapping
,
$results
,
$force_pull
);
// @TODO Replace this with a better implementation when available,
// see https://www.drupal.org/node/2820345, https://www.drupal.org/node/2785211
$mapping
->
setLastPullTime
(
$this
->
time
->
getRequestTime
());
return
$results
->
size
();
}
}
...
...
@@ -228,10 +225,17 @@ class QueueHandler {
* there are additional records to be queried.
*/
public
function
enqueueResultSet
(
SalesforceMappingInterface
$mapping
,
SelectQueryResult
$results
,
$force_pull
=
FALSE
)
{
$max_time
=
0
;
$triggerField
=
$mapping
->
getPullTriggerDate
();
try
{
foreach
(
$results
->
records
()
as
$record
)
{
// @TODO? Pull Queue Enqueue Event
$this
->
enqueueRecord
(
$mapping
,
$record
,
$force_pull
);
$record_time
=
strtotime
(
$record
->
field
(
$triggerField
));
if
(
$max_time
<
$record_time
)
{
$max_time
=
$record_time
;
$mapping
->
setLastPullTime
(
$max_time
);
}
}
return
$results
->
done
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment