Fix thread safety issue in multi-stage ingest job