Skip to content

Conversation

@zwidekalanga
Copy link
Contributor

Description:
Add a description of your changes here.

Jira:
ENT-11059 & ENT-11123

Merge checklist:

  • ./manage.py makemigrations has been run
    • Note: This must be run if you modified any models.
      • It may or may not make a migration depending on exactly what you modified, but it should still be run.

Post merge:

  • Ensure that your changes went out to the stage instance
  • Deploy to prod instance

Comment on lines +71 to +79
self.stdout.write(
f'{mode_label}Checking for CheckoutIntent records stuck in paid state '
f'for more than {threshold_seconds} seconds...'
)
logger.info(
'%sStarting mark_stalled_checkout_intents command with threshold=%s seconds',
mode_label,
threshold_seconds,
)
Copy link
Contributor

@pwnage101 pwnage101 Nov 5, 2025

Choose a reason for hiding this comment

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

I think we can remove one of these duplicative messages throughout the code. I'm pretty sure logger already goes to stdout, and the stdout messages are not already designed to be machine-readable, so I think we can just remove the stdout.write() lines and keep the logger.info lines

Functionally, you're using stdout.write() as a logger, but it's weaker than logger because it lacks timestamps and other useful metadata.

Comment on lines +146 to +150
self.stdout.write(
self.style.SUCCESS(
f'{mode_label}Command completed successfully'
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, this is the only self.stdout.write() I'd keep, to leverage the success style.

threshold_seconds,
)

if dry_run:
Copy link
Contributor

Choose a reason for hiding this comment

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

This implementation of a dry run isn't quite appropriate because it replaces too much business logic. A better approach would be to pass a dry run flag into a lower level function and implement dry run within.

Comment on lines +121 to +123
updated_count, updated_uuids = CheckoutIntent.mark_stalled_fulfillment_intents(
stalled_threshold_seconds=threshold_seconds
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably where dry_run needs to be passed.

@zwidekalanga zwidekalanga deleted the feat/terminate-stuck-paid-checkout-intent branch November 6, 2025 09:08
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.

2 participants