diff --git a/make_post_sell/lib/crypto_watcher/__init__.py b/make_post_sell/lib/crypto_watcher/__init__.py index 43ad03c..12378a6 100644 --- a/make_post_sell/lib/crypto_watcher/__init__.py +++ b/make_post_sell/lib/crypto_watcher/__init__.py @@ -8,6 +8,7 @@ from typing import List from decimal import Decimal from urllib.parse import urlparse +import sqlalchemy as sa from pyramid.paster import bootstrap, setup_logging from .crypto_clients import get_client_from_settings, get_dogecoin_client_from_settings @@ -2997,6 +2998,10 @@ def process_refund_confirmations(request, settings): # Query payments that need refund confirmation monitoring OR retry refund_queue = ( db.query(CryptoPayment) + .options( + sa.orm.joinedload(CryptoPayment.user), + sa.orm.joinedload(CryptoPayment.shop), + ) .filter( CryptoPayment.status.in_( [ @@ -3548,6 +3553,10 @@ def scan_wallet_for_double_or_late_payments(request, settings): # Look up payment by subaddress payment = ( db.query(CryptoPayment) + .options( + sa.orm.joinedload(CryptoPayment.user), + sa.orm.joinedload(CryptoPayment.shop), + ) .filter( CryptoPayment.coin_type == coin_type, CryptoPayment.account_index == account_idx, @@ -3729,6 +3738,10 @@ def scan_wallet_for_double_or_late_payments(request, settings): # Look up payment by address payment = ( db.query(CryptoPayment) + .options( + sa.orm.joinedload(CryptoPayment.user), + sa.orm.joinedload(CryptoPayment.shop), + ) .filter( CryptoPayment.coin_type == coin_type, CryptoPayment.address == tx.get("address"), @@ -3910,6 +3923,10 @@ def run_once(env, interval): q = ( db.query(CryptoPayment) + .options( + sa.orm.joinedload(CryptoPayment.user), + sa.orm.joinedload(CryptoPayment.shop), + ) .filter( CryptoPayment.status.in_(all_monitored_statuses), CryptoPayment.swept_tx_hash.is_(