If the second batch is being create with another call to $client->startBatch()
it will actually be the same batch object as $batch
. If you call $client->commitBatch()
from there, it will commit the outer batch (since they are the same.)
Don't start a second batch in Model_History::create()
. Start the outer batch, go through all your code, and commit it once at the end.