| Summary: | [Shell] Prevent unnecessary parse calls in orion.shell.type support | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Maciej Bendkowski <maciej.bendkowski> |
| Component: | Client | Assignee: | Grant Gayed <grant_gayed> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 4.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Maciej Bendkowski
Your plug-in's #parse implementation has a "context" argument with a lastParseTimestamp value, whose purpose is to help with caching decisions. Its value is 0 for the initial #parse call, and in subsequent calls is set to the timestamp of the last #parse invocation. In your case you would initiate the xhr on the first invocation (lastParseTimestamp === 0) and return a promise. The next three #parse invocations, assuming the xhr has not returned yet, would just return promises. When your xhr resolves then the promises can all be resolved. If you cache the xhr result then you may not need to initiate a new xhr on the next #parse invocation, depending on whether you think the time interval has been too short to have likely made a difference. I agree that four #parse invocations seems excessive. They're originating from GCLI, and I have not examined whether there's a reliable way to identify seemingly redundant #parse's in order to hide them from plug-ins. In the meantime the use of lastParseTimestamp should help you with managing these extra invocations. (In reply to comment #1) > In your case you would initiate the xhr on the first invocation > (lastParseTimestamp === 0) and return a promise. The next three #parse > invocations, assuming the xhr has not returned yet, would just return > promises. When your xhr resolves then the promises can all be resolved. If > you cache the xhr result then you may not need to initiate a new xhr on the > next #parse invocation, depending on whether you think the time interval has > been too short to have likely made a difference. This would be great, but those four initial calls have all the lastParseTimestamp set to 0. This way I can't distinguish between them in a 'gentle' way. It could be done using a hack to actually share the promise object, however manual thread synchronization is JS is NOT a desirable solution here.. Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see: https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html |