sf_node: Call to sf_node_import triggers call to sf_node_export
| Project: | Salesforce |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | aaronbauman |
| Status: | closed |
Jump to:
Calling sf_node_import fires node_save, which triggers the update operation in sf_node_nodeapi and results in a sf_node_export call.
An "import" should only import, not import then export.
ie. There should be a way to disable outbound nodeapi operations when performing imports.
Otherwise, we could run into recursion problems, not to mention unnecessary SalesForce API calls.
Consider a simple case where the user has enabled salesforce outbound SOAP messaging:
- import a record from salesforce
- save record as a drupal node
- export the record back to salesforce
- Salesforce triggers an outbound message back to Drupal
- go back to #1
Consider a case of mass imports:
Using a few SalesForce API calls, I query for and gather all the SF data I want to import -- possibly thousands of records, but all returned in a relatively small number of queries. Then for each imported node, node_save() invokes a sf_node_export() -- an extra API call for each node.
Dunno if this is the optimal method, but the attached patch implements a node property "sf_node_skip_export" that short-circuits nodeapi operations on sf_node_import.
| Attachment | Size |
|---|---|
| import-export-issue.patch | 1.57 KB |

#1
I have tested this. It works as advertised. Since it is fixing a very real bug which occurs whenever one imports, I recommend committing this patch.
#2
http://drupal.org/cvs?commit=245214
I didn't test this explicitly but I trust aaron's call on this one, the solution makes sense and the patch is clean.
#3
I tweaked this to use return instead of break for style consistency. functionality would not be changed by this: http://drupal.org/cvs?commit=245242
#4
Automatically closed -- issue fixed for 2 weeks with no activity.