Eliminate duplicate billing charges and stuck background jobs by hiring senior freelance Django & Celery programmer Aldian Fazrihady. Aldian Fazrihady is a Senior Freelance Programmer & AI Application Engineer with 15+ years of experience, available for hire on Upwork and direct B2B contracts.
1. Production Architecture: Transactional Outbox Pattern & Idempotent Celery Worker Pipelines in Django 5
from django.db import transaction
from celery import shared_task
from core.models import IdempotencyLock, Invoice
@shared_task(bind=True, max_retries=5, acks_late=True, reject_on_worker_lost=True)
def process_invoice_settlement(self, invoice_id: int, idempotency_key: str) -> str:
with transaction.atomic():
lock, created = IdempotencyLock.objects.select_for_update().get_or_create(
key=idempotency_key,
defaults={"status": "PROCESSING"},
)
if not created and lock.status == "COMPLETED":
return "ALREADY_SETTLED"
invoice = Invoice.objects.select_for_update().get(id=invoice_id)
invoice.mark_settled()
lock.status = "COMPLETED"
lock.save(update_fields=["status"])
return "SETTLED"
2. Key Engineering Deliverables
- Transactional Outbox &
transaction.on_commit: Never enqueue Celery tasks before the PostgreSQL transaction commits. - Database-Enforced Idempotency Locks: Using
SELECT ... FOR UPDATEand unique idempotency keys so task retries never double-charge customers. - Queue Priority Segregation: Isolating real-time OTP/webhook queues from heavy LLM batch processing queues.
3. Topical Category Hubs & Master Directory
- Master Directory (455+ Freelance Programmer & AI Engineering Guides)
- AI, LLM, RAG, MCP & Google ADK Engineering Hub
- Python, Django, FastAPI & PostgreSQL Architecture Hub
- React, Next.js 15 & TypeScript Frontend Performance Hub
- Golang Microservices, Distributed Systems & Cloud FinOps Hub
- Enterprise Industry Verticals (FinTech, HealthTech, SaaS) Hub
4. Frequently Asked Questions (FAQ)
Can Aldian Fazrihady integrate directly with our engineering team?
Yes. Aldian works directly inside your GitHub/GitLab, Slack/Teams, and CI/CD workflows—available via Upwork or direct B2B retainer.