Problem with MoveTo and MoveBy actions on a node

I am having a camera in the scene whose position I am changing based on a touch on the scene using either moveTo or moveBy action.I am changing the camera’s z coordinate in the move action.But the camera’s z coordinate does not update immediately after the action is run.It updates on the subsequent touch.What could be the reason for this?
The sample code is as below-

bool PlayGround::onTouchBegan(Touch* touch, Event* event) {

location = touch->getLocation();
if(location.y > 50){

auto move = MoveBy::create(2.0,Vec3(0,0,-20));
camera->runAction(move);
}
}