Change Log v2.0.0
Release Information
Version: 2.0.0
Type: Major Release
Version 2.0.0 is a major release that introduces fundamental improvements to performance, developer experience, and overall architecture. This release includes breaking changes that require migration from v1.x.
🚀 New Features
Prefetching System
- Job Buffer: Introduced a new prefetching system with job buffer capabilities
- Performance Boost: Queues can now pre-load jobs for improved processing performance
- Configurable Buffer Size: Customize buffer size based on your application needs
Smart Queue Processing
- Handler-Based Fetching: Queues now only fetch jobs based on registered handler names
- Improved Efficiency: Eliminates unnecessary job fetching, reducing database load
- Better Resource Utilization: Each queue processes only the jobs it can handle
Enhanced Build System
- Node.js Optimization: Improved build process for Node.js environments
- Bun Support: Enhanced build optimizations for Bun runtime
Improved Naming Convention
- RedisJobQueue:
DistributedJobQueue
has been renamed toRedisJobQueue
for clarity - Consistent Naming: Better alignment with other queue implementations
- Clearer Intent: More descriptive class names throughout the library
🔧 Improvements
- Simplified Configuration: Removed confusing
standalone
option from queue configurations - Better Error Messages: Enhanced error reporting with more descriptive messages
- Performance Optimizations: Various micro-optimizations throughout the codebase
- Documentation Updates: Comprehensive documentation improvements
⚠️ Breaking Changes
Important Migration Required
This is a major version release with breaking changes. Please review the migration guide below.
Class Name Changes
// v1.x
import { DistributedJobQueue } from '@backgroundjs/core'
// v2.0.0
import { RedisJobQueue } from '@backgroundjs/core'
Configuration Changes
// v1.x - standalone option removed
const queue = new RedisJobQueue({
standalone: true, // ❌ No longer supported
// ... other options
})
// v2.0.0
const queue = new RedisJobQueue({
// ... other options
})
Prefetching Requirements
- MongoDB: Requires replica set configuration for transaction support
- Redis: No additional requirements
- PostgreSQL: No additional requirements
📋 Migration Guide
Step 1: Update Dependencies
npm install @backgroundjs/core@^2.0.0
Step 2: Update Import Statements
Replace all instances of DistributedJobQueue
with RedisJobQueue
:
// Before
import { DistributedJobQueue } from '@backgroundjs/core'
// After
import { RedisJobQueue } from '@backgroundjs/core'
Step 3: Remove Standalone Configuration
Remove the standalone
option from your queue configurations:
// Before
const queue = new RedisJobQueue({
standalone: true,
// ... other options
})
// After
const queue = new RedisJobQueue({
// ... other options
})
Step 4: MongoDB Setup (if using prefetching)
If you're using MongoDB and want to enable prefetching, ensure your MongoDB instance is configured as a replica set:
// MongoDB connection for prefetching
const queue = new MongoDBJobQueue(storage, {
name: "test",
processingInterval: 100,
concurrency:20,
preFetchBatchSize:100,
maxRetries: 3,
});
🐛 Bug Fixes
- Fixed memory leaks in long-running queue processes
- Resolved race conditions in concurrent job processing
📚 Documentation
- Updated all examples to use v2.0.0 syntax
- Added comprehensive migration guide
- Enhanced API documentation with better examples
- Added troubleshooting section for common issues
🔍 Technical Details
Compatibility
- Node.js: 18.x and later
- Bun: 1.0.x and later
- TypeScript: 4.5.x and later
⚠️ Important Notes
MongoDB Prefetching Requirements
MongoDB requires transactions for the prefetching feature. If you want to use prefetching with MongoDB, your instance must be configured as a replica set.
For development, you can set up a single-node replica set:
mongod --replSet rs0
# In mongo shell: rs.initiate()
🤝 Contributing
Found an issue or want to contribute? Check out our GitHub repository for the latest updates and contribution guidelines.
Need help with migration? Check out our support page or open an issue on GitHub.