Senior Python Backend Developer for High-Concurrency "Key Bank"FreelanceJobs • Canada
This job offer is no longer available
Senior Python Backend Developer for High-Concurrency "Key Bank"
FreelanceJobs
- Canada
- Canada
About
Senior Python Backend Developer for High-Concurrency Key Bank System
Job Description:
Project Overview
We are looking for a Senior Python Developer to build a robust middleware system called The Key Bank. This system will dispense digital license keys to customers immediately after they purchase a course on our WordPress site.
The Challenge
We sell course keys via a WordPress scheduling plugin. During flash sales, multiple users buy at the exact same second. We need a system that guarantees Atomic Transactions so the same key is never sold to more than one user. You must prevent the Double Spend scenario.
The Tech Stack
-- Backend: Python (FastAPI or Flask)
-- Database: MySQL 8.0 or higher (Must understand Row Locking with SKIP LOCKED)
-- Frontend Source: WordPress Webhooks (Amelia or Bookly plugin)
Core Responsibilities
Database Architecture: Build a MySQL table that acts as a FIFO queue for license keys.
Concurrency Logic: Implement MySQL Row Locking (FOR UPDATE SKIP LOCKED) to handle simultaneous requests safely without deadlocks.
Webhook Parsing: Create an endpoint that receives JSON from WordPress, verifies a secret token, and extracts the Coupon Code and User Email.
Email Dispatch: Integrate SendGrid or Postmark to email the key to the user using our HTML template.
Reliability: Set up a Cron job to alert us when inventory drops below 10 keys.
Required Experience
-- Deep understanding of Database Locking and Race Conditions.
-- Experience parsing unstructured webhooks from WordPress plugins.
-- Ability to write error handling that alerts admins instead of crashing the checkout process.
Screening Question
Please explain why you would use SKIP LOCKED instead of a standard row lock for a high-traffic inventory queue. What happens to the database connection pool if you do not use it?
Budget and Timeline
-- Budget: Fixed Price 1000 USD (or Hourly 30 to 50 USD per hour)
-- Timeline: Production-ready within 2 weeks.
SECTION 2: PROJECT SPECIFICATION
(Save this as a text file or PDF and upload it as an attachment to the job post. Do not paste this into the description box if it has character limits.)
PROJECT TECHNICAL BUILD GUIDE
1. Architecture Strategy
We are bypassing WordPress PHP for the heavy lifting. The flow is:
User Books on WP implies WP Plugin sends Webhook implies Python Middleware implies DB Lock and Assign implies Email Key.
2. Database Schema Requirements
We need a table named license_keys with the following columns:
-- id (Primary Key, Auto Increment)
-- license_key (String, Unique, Not Null)
-- status (String, Default 'available'. Values: available, assigned, revoked)
-- product_sku (String, Not Null. Example: rqi_bls)
-- assigned_to_email (String, Nullable)
-- assigned_order_id (String, Nullable. Stores the Booking ID)
-- assigned_coupon_code (String, Nullable. Tracks which code was used)
-- assigned_at (Timestamp)
Indexes are required on the Status and Product SKU columns to ensure the locking query is fast.
3. The Webhook Listener Logic
The scheduling plugins (Amelia or Bookly) send messy JSON data. Your code must normalize this.
Security Requirement:
Since these plugins often lack digital signatures, you must implement a Secret Token check in the URL parameters. Example:
Processing Logic:
Security Check: Verify the token matches our environment variable.
Parse Data: Extract customer email and the Coupon Code. Note that plugins often bury the coupon code in nested objects or custom fields. You must check multiple locations in the payload.
Idempotency: Check if the Order ID already exists in our database. If it does, return 200 OK immediately to prevent double-processing.
Atomic Vending: Execute the database transaction using SKIP LOCKED to get the next available key.
Dispatch: Send the email to the customer.
4. Safety Nets
-- Cron Job: Every hour, count the rows where status is 'available'. If the count is less than 10, email the Admin immediately.
-- Fail-Safe: If the system is out of stock, do not return a 500 error to WordPress. Return 200 OK and trigger an internal Urgent Email to the admin to fulfill the order manually.
5. Designer Brief (For Email Templates)
-- The Key Box: Create a distinct, centered box that holds the License Key. Use a Monospace font (Courier, Consolas) so characters like 0 and O are distinguishable.
-- Outlook Compatibility: Do not use Div tags for layout. Use HTML Tables only. All CSS must be inline.
-- Dark Mode: Use transparent PNG images for logos and icons to prevent white boxes appearing in Dark Mode.
Contract duration of 1 to 3 months.
Mandatory skills: API Integration, Web Development, Python, SQL, Database
Languages
- English
Notice for Users
This job was posted by one of our partners. You can view the original job source here.