batch-loader
batch-loader copied to clipboard
How to debug the code inside batch loader block
Hey all, I'm trying to print out the variable values inside of batch blocks for debug purpose, but somehow it doesn't work. Nothing print out. I wonder if anyone knows how to do that? Thanks a lot.
BatchLoader.for(object).batch do |meals, loader|
billables = InternalClient::MakomoClient.billables_by_consumption_owners(
owners: meals,
internal_name: MENU_PRICE_NAME
).group_by { |b| b.owner_id.to_i }
puts billables
meals.each do |meal|
menu_price = billables[meal.id].result.first.amount
loader.call(meal, menu_price)
end
end
Given the nature of BatchLoader doing something like this will help you:
$stdout.write "I want do debug this"