Order of Operations for Chef-Client

Does anyone know when a node gets registered on a Chef server when ran for the very first time? Does the registration happen at the end of a chef-client run after resources are executed? Or somewhere before that?

I ask because we have in one of our recipes a line that performs a node search for a number of nodes before executing some logic that involves setting up a cluster. We're wondering if its worth adding a wait of a few minutes since all nodes will be created around the same period of time, instead of waiting for the next chef-client run that happens 60 minutes later in our environment or logging in and running it manually. This would require that the nodes we're expecting are registered even while waiting on the very first chef-client run when we bootstrap the node with a list of recipes to run.

The node object is saved back in the chef-server at end of a successful run, it is then indexed in the few minutes after that.

You may be able to call node.save in your recipe and then doing a retry on search untill it comes back with results.

This is not recommended, as it's a loose kind of orchestration and cluster setups are better done with an external system driving the chef-runs in the proper sequence IMHO.