Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to debug the code inside batch loader block #78

Open
xchen1189 opened this issue Jun 23, 2021 · 1 comment
Open

How to debug the code inside batch loader block #78

xchen1189 opened this issue Jun 23, 2021 · 1 comment

Comments

@xchen1189
Copy link

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
@elcuervo
Copy link

Given the nature of BatchLoader doing something like this will help you:

$stdout.write "I want do debug this"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants