Changelog¶
All notable changes to PG Scheduler will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.2.2 - 2026-03-16¶
Changed¶
Updated and streamlined README / PyPI page
0.2.1 - 2026-03-15¶
Fixed¶
Per-job misfire_grace_time ignored when scheduler default is None: The job expiration logic was entirely skipped when the scheduler’s
misfire_grace_timewas set toNone, causing jobs with explicit per-jobmisfire_grace_timeto never expire. Removed the Python-side guard so the SQL query now always runs and relies onmisfire_grace_time IS NOT NULLto correctly expire only jobs with an explicit grace time.get_periodic_job_status crashes for cron-based periodic jobs: Calling
get_periodic_job_statuson a cron-based job raisedAttributeErrorbecause it unconditionally accessedconfig.interval.total_seconds(). Now correctly handles both interval-based and cron-based jobs, returningintervalorcron/timezonefields as appropriate.
0.2.0 - 2026-02-02¶
Added¶
Bulk job scheduling: New
schedule_bulk()method for high-performance batch insertsSchedule thousands of jobs in a single database transaction
10-100x faster than individual
schedule()calls for batch operationsNew
JobSpecdataclass for defining job specificationsSupports all existing job parameters (priority, retries, custom IDs, misfire grace time)
Configurable
batch_sizeparameter for chunking large batches (default: 1000)Conflict resolution support (IGNORE, REPLACE, RAISE) applied to entire batch
Configurable batch claiming: New
batch_claim_limitparameter inScheduler.__init__to control max jobs claimed per batch (default: 10)Cron-based scheduling: Full support for cron expressions in
@periodicdecoratorUse
cronparameter instead ofevery(e.g.,cron="0 0 * * *"for daily at midnight)Supports all standard cron syntax:
*/15 * * * *,0 9-17 * * MON-FRI, etc.Requires
croniter>=3.0.0dependency
🌍 Timezone support: Schedule cron jobs in any timezone
Use
timezoneparameter with cron expressions (e.g.,timezone="America/New_York")Supports both string timezone names and
ZoneInfoobjectsAutomatically converts to UTC for internal storage
Enhanced
@periodicdecorator: Now supports both interval and cron-based scheduling modesNew priority levels: Added
JobPriority.HIGHandJobPriority.LOWfor finer-grained priority controlPer-job misfire grace time configuration: Jobs can now override the scheduler’s default grace time
Support for
misfire_grace_time=Noneto disable job expiration entirely
Changed¶
Code organization improvements: Major refactoring for better modularity
JobPrioritymoved topg_scheduler/job_priority.pyPeriodic job functionality moved to
pg_scheduler/periodic.pyConflict resolution strategies moved to
pg_scheduler/conflict_resolution.pyVacuum policies moved to
pg_scheduler/vacuum.py
Scheduler.__init__now acceptsOptional[int]formisfire_grace_timeparameterScheduler.schedule()now accepts optionalmisfire_grace_timeparameter for per-job configurationscheduled_jobstable schema updated to includemisfire_grace_time INTEGERcolumn
Migration Notes¶
Backward Compatible: Existing code will continue to work without changes
Automatic Migration: The
misfire_grace_timecolumn is automatically added to existing tablesNo Breaking Changes: The API is fully backward compatible
0.1.0 - 2025-09-29¶
Added¶
Core Features¶
Job Scheduler: PostgreSQL-based async job scheduling system
Periodic Jobs:
@periodicdecorator for recurring tasks with automatic registrationDeduplication: Cross-replica job deduplication using deterministic job IDs
Self-rescheduling: Automatic rescheduling of periodic jobs after completion
Priority System: Support for
JobPriority.NORMALandJobPriority.CRITICALRetry Logic: Configurable retry attempts with exponential backoff
Reliability Features¶
Heartbeat Monitoring: Detect and recover from crashed workers
Orphan Recovery: Automatic cleanup of abandoned jobs
Graceful Shutdown: Wait for active jobs to complete before stopping
Lease-based Execution: Explicit job ownership with timeouts
Atomic Job Claiming: Race-condition-free job distribution
Advanced Features¶
Advisory Locks: Optional PostgreSQL advisory locks for exclusive execution
Vacuum Policies: Configurable cleanup policies for job lifecycle management
Conflict Resolution: Flexible strategies for handling duplicate job IDs
Job Management API: Runtime control of periodic jobs (enable/disable/trigger)
Production Features¶
Multi-replica Support: Safe deployment across multiple worker instances
Comprehensive Logging: Detailed logging with worker identification
Error Handling: Robust error handling and recovery mechanisms
Database Optimization: Efficient queries and indexing strategies
Documentation¶
Comprehensive README with installation and usage examples
API documentation for all major components
Production deployment guidelines
Docker and Kubernetes configuration examples
Performance tuning recommendations
Examples¶
Basic job scheduling examples
Periodic job patterns and best practices
Production configuration templates
Integration examples (FastAPI, Django)
Technical Details¶
Python Support: 3.9+
PostgreSQL Support: 12+
Dependencies: asyncpg for database connectivity
Architecture: Async/await throughout for maximum performance
Database Schema: Optimized table structure with proper indexing