does node_save wait until end of php session to create db record? Is it possible/expected that node_save() does not create a new record until the current php session is complete?

In other words, if i have a set of nodes to create and i need to check something that is based on the entire list of nodes prior to creating each one; the ones i am creating in my script will not yet be included in the full list?
Is it possible/expected that node_save() does not create a new record until the current php session is complete?


I'm not sure 'session' is the right word there, I'm assuming you mean 'current request' (queuing actions to be run when the session has expired would be an odd thing, and not something PHP/Drupal would do without you telling it to).

Either way, before node_save() completes it commits the database transaction and flushes relevant caches. So no, it doesn't wait for the current request to complete.

So to address


  the ones i am creating in my script will not yet be included in the full list?


No, once you've saved the node, and assuming it completed without error, it will be in the database and available immediately via node_load(). 

Of course you don't actually need to load it, as your $node object will be in an identical state to the loaded node when node_save() has completed anyway.

Ignoring all that, if you actually mean "does running node_save() automatically update an array of nodes I've previously loaded into a variable earlier in the script", then also no. That would be magic :)