-
Notifications
You must be signed in to change notification settings - Fork 2
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
Pricing improvements and bug fixes #379
Conversation
To allow for blocking and non-blocking versions that handle exceptions differently
to make it easier to use for admins & enterprise users
…ithout parametrizing
migrations.AlterField( | ||
model_name='appuser', | ||
name='subscription', | ||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user', to='payments.subscription'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this migration is not from a model change in another commit.
the addition is blank=True
celeryapp/tasks.py
Outdated
run_low_balance_email_check(uid) | ||
run_auto_recharge_gracefully(uid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is run in the same thread, at the end of a task. not in a background task
daras_ai_v2/base.py
Outdated
if not settings.CREDITS_TO_DEDUCT_PER_RUN: | ||
return True | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check_credits()
was always being used with this check.
i felt more convenient to include that check here so we could call check_credits()
only whenever we wanted.
_render_plan_action_button( | ||
user, plan, current_plan, selected_payment_provider | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
payment_provider
name became ambiguous in the later functions, where it wasn't obvious that payment_provider is the one selected by user in the UI (from the radio button)
Earlier, prorations were on, and someone who purchases a subscription today will be charged the prorated amount + the next month's charge in the next invoice. This commit fixes that behaviour by charging the full subscription amount on the same day. The billing cycle will also change to create the next invoice 1 month from the same day.
…ents # Conflicts: # app_users/migrations/0017_alter_appuser_subscription.py # celeryapp/tasks.py # daras_ai_v2/base.py # poetry.lock # routers/api.py
optimize run time of runner_task: check for credits only once in entire call chain, separate post run stuff into a separate task fix run complete email for empty prompts
d42e719
to
e6b9955
Compare
Bug fixes:
Refactors
Improvements
logger.exception(...)
orlogger.critical(...)
and works on both the local and production environments. (all these exceptions will be raised in sentry the same assentry_sdk.capture_exception
)Commits:
Q/A checklist
You can visualize this using tuna:
To measure import time for a specific library:
To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file: