2

After performing the $A.enqueueAction(anAction); the response provided with anAction.setCallback(this, aCallback); takes too long to execute (I should wait for something like 1-5 minutes after $A.enqueueAction(anAction); before the aCallback is executed). I checked that there are no errors and the response actually comming every time with a "SUCCESS" state.

I happens with every queued action. Are there any ways to make the backend send the response faster? Maybe there is some kind of a prioritization is present?

3
  • 1
    We would need some code to know for sure, but it sounds like you're trying to call $A.enqueueAction outside of the component life cycle. Make sure you're following the rules in the Modifying Components Outside the Framework Lifecycle documentation. It should never take more than a second for the server to start processing the action if you're doing so within the component life cycle.
    – sfdcfox
    Jun 15, 2018 at 13:15
  • @sfdcfox, could you please post it as an answer. It helped me out. Or should I delete the question? And where did you happen to read about that thing? I mean there are a lot of gaps I have and I would like systematically fill them. Jun 15, 2018 at 13:54
  • Sure, I can add an answer for you. It's all in the documentation, you just need to take the time to read/research it. I can't really explain it to you how I do it, because I'm not really sure how I do it.
    – sfdcfox
    Jun 15, 2018 at 13:57

1 Answer 1

4

You need to make sure that any actions you're calling are called within the framework lifecycle. This typically means that you need to use $A.getCallback in situations where you're not responding to a Lightning Event or a Lightning Callback in order to let the framework know that you're modifying the component or trying to invoke an action. You can read more in the Modifying Components Outside the Framework Lifecycle documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .