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

Add task to print Subscriptions debug info #6293

Merged
merged 3 commits into from
Nov 27, 2020

Conversation

luisramos0
Copy link
Contributor

@luisramos0 luisramos0 commented Nov 2, 2020

What? Why?

I think we need a few apges on the app itself for this but this is a start: whoever is debugging a specific Order Cycle can now run this task and get very useful info about what is going on in the subscriptions of the given Order Cycle.

I have done this a few dozen times in prod now, I thought of not doing it again. Each of the parts of this data will explain many different support scenarios and questions: from paused subscriptions, expired credit cards to failed stripe payments.

What should we test?

Run this task with a Order cycle ID and get info from all subscriptions affected by the Order Cycle.

Release notes

Changelog Category: Technical changes
Make Subscriptions debugging easier for developers.

@luisramos0 luisramos0 changed the title Subs debug Add task to print Subscriptions debug info Nov 2, 2020
@luisramos0 luisramos0 self-assigned this Nov 2, 2020
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
lib/tasks/subscriptions/debug.rake Show resolved Hide resolved
puts "Canceled at #{subscription.canceled_at} and paused at #{subscription.paused_at}"

ProxyOrder.where(order_cycle_id: order_cycle_id,
subscription_id: subscription.id).each do |proxy_order|
Copy link
Contributor

@sauloperez sauloperez Nov 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should stay on the safe side with all these DB fetches using find_each and avoid potential problems in the future with all these nested iterations loading all these objects. I'm happy to go on with this and fix it in a separate PR myself.

@sauloperez sauloperez merged commit 8b6a084 into openfoodfoundation:master Nov 27, 2020
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

Successfully merging this pull request may close these issues.

4 participants