0.1.8 #22

Merged
NiXTheDev merged 25 commits from dev into release 2026-02-13 17:54:04 +03:00
NiXTheDev commented 2026-02-13 17:49:24 +03:00 (Migrated from github.com)

What's New in 0.1.8

🚀 Worker Pool V2: Dynamic Scaling

The bot now features an optional Worker Pool V2 with intelligent dynamic scaling:

  • Lazy Initialization: Starts with minimal workers (default: 1) and scales up as needed
  • Auto-Scaling: Automatically spawns workers when queue grows, up to configured max (default: 8)
  • Idle Scale-Down: Terminates idle workers after timeout (default: 15 min), keeping minimum workers alive
  • Configurable Limits: Full control via environment variables:
    • WORKER_POOL_V2_ENABLED - Enable V2 (default: false)
    • WORKER_POOL_MIN_WORKERS - Minimum workers to keep (default: 0)
    • WORKER_POOL_MAX_WORKERS - Maximum workers allowed (default: 8)
    • WORKER_POOL_INITIAL_WORKERS - Workers to spawn on startup (default: 1)
    • WORKER_POOL_IDLE_TIMEOUT_MS - Idle timeout before scaling down (default: 15 min)
    • WORKER_POOL_IDLE_CHECK_INTERVAL_MS - How often to check for idle workers (default: 5 min)

🛑 Graceful Shutdown Enhancement

New graceful drain option for Docker deployments:

  • Graceful Drain Mode: When enabled, the bot processes pending tasks before shutting down instead of immediately rejecting them
  • Configuration:
    • GRACEFUL_DRAIN - Enable graceful drain (default: false for safety)
    • GRACEFUL_DRAIN_TIMEOUT_MS - Max time to drain queue (default: 8000ms, max: 9500ms for Docker compatibility)
  • Docker Compatible: Default timeout fits within Docker's 10s grace period
  • Scales During Drain: When draining, pool temporarily spawns extra workers beyond normal limits to process queue faster

🧪 Testing Improvements

  • Added comprehensive WorkerPoolV2 test suite (9 tests)
  • Created Docker graceful shutdown test script (docker/test-graceful-shutdown.sh)
  • Updated shutdown integration tests
  • All 77 tests passing

📝 Documentation

  • Updated README with new environment variables
  • Added Docker deployment section with graceful shutdown documentation
  • Updated .env.example with all new configuration options

🔧 Other Improvements

  • Added correlation ID support for operation tracing in logs
  • Restructured project with src/ directory for better organization
  • Improved graceful shutdown handler with timeout and healthcheck cleanup
  • Updated dependencies (grammy 1.39.3 → 1.40.0)

🐛 Bug Fixes

  • Fixed worker path resolution in hellspawn.ts
  • Fixed CI test paths after directory restructure
  • Fixed Dependabot target branch configuration

🏗️ Infrastructure

  • Removed lockfile from repository
  • Updated Docker build tags (removed commit hash tags)
  • Updated Bun version in CI to 1.3.9

📋 Breaking Changes

None. All changes are backward compatible. Worker Pool V2 is opt-in via WORKER_POOL_V2_ENABLED=false (default).

📁 Files Changed

  • New: src/workerPoolV2.ts - Dynamic worker pool implementation
  • New: src/workerPoolInterface.ts - Common interface for worker pools
  • New: src/tests/workerPoolV2.test.ts - Test suite
  • New: docker/test-graceful-shutdown.sh - Docker test script
  • Modified: src/config.ts - New configuration options
  • Modified: src/index.ts - Graceful shutdown integration
  • Modified: src/workerPool.ts - Added monitoring methods
  • Modified: README.md - Documentation updates
  • Modified: .env.example - Configuration examples
  • Modified: docker/docker-compose.yml - Graceful drain examples

Checklist

  • Worker Pool V2 implemented and tested
  • Graceful drain configuration added
  • Docker graceful shutdown tested
  • All tests passing (77/77)
  • Documentation updated
  • Environment variables documented
  • Backward compatibility maintained

Closes #14
Closes #15
Closes #16
Closes #17
Closes #20

Full Changelog: dev...release

## What's New in 0.1.8 ### 🚀 Worker Pool V2: Dynamic Scaling The bot now features an optional Worker Pool V2 with intelligent dynamic scaling: - **Lazy Initialization**: Starts with minimal workers (default: 1) and scales up as needed - **Auto-Scaling**: Automatically spawns workers when queue grows, up to configured max (default: 8) - **Idle Scale-Down**: Terminates idle workers after timeout (default: 15 min), keeping minimum workers alive - **Configurable Limits**: Full control via environment variables: - `WORKER_POOL_V2_ENABLED` - Enable V2 (default: false) - `WORKER_POOL_MIN_WORKERS` - Minimum workers to keep (default: 0) - `WORKER_POOL_MAX_WORKERS` - Maximum workers allowed (default: 8) - `WORKER_POOL_INITIAL_WORKERS` - Workers to spawn on startup (default: 1) - `WORKER_POOL_IDLE_TIMEOUT_MS` - Idle timeout before scaling down (default: 15 min) - `WORKER_POOL_IDLE_CHECK_INTERVAL_MS` - How often to check for idle workers (default: 5 min) ### 🛑 Graceful Shutdown Enhancement New graceful drain option for Docker deployments: - **Graceful Drain Mode**: When enabled, the bot processes pending tasks before shutting down instead of immediately rejecting them - **Configuration**: - `GRACEFUL_DRAIN` - Enable graceful drain (default: false for safety) - `GRACEFUL_DRAIN_TIMEOUT_MS` - Max time to drain queue (default: 8000ms, max: 9500ms for Docker compatibility) - **Docker Compatible**: Default timeout fits within Docker's 10s grace period - **Scales During Drain**: When draining, pool temporarily spawns extra workers beyond normal limits to process queue faster ### 🧪 Testing Improvements - Added comprehensive WorkerPoolV2 test suite (9 tests) - Created Docker graceful shutdown test script (`docker/test-graceful-shutdown.sh`) - Updated shutdown integration tests - All 77 tests passing ### 📝 Documentation - Updated README with new environment variables - Added Docker deployment section with graceful shutdown documentation - Updated `.env.example` with all new configuration options ### 🔧 Other Improvements - Added correlation ID support for operation tracing in logs - Restructured project with `src/` directory for better organization - Improved graceful shutdown handler with timeout and healthcheck cleanup - Updated dependencies (grammy 1.39.3 → 1.40.0) ### 🐛 Bug Fixes - Fixed worker path resolution in `hellspawn.ts` - Fixed CI test paths after directory restructure - Fixed Dependabot target branch configuration ### 🏗️ Infrastructure - Removed lockfile from repository - Updated Docker build tags (removed commit hash tags) - Updated Bun version in CI to 1.3.9 ### 📋 Breaking Changes None. All changes are backward compatible. Worker Pool V2 is opt-in via `WORKER_POOL_V2_ENABLED=false` (default). ### 📁 Files Changed - New: `src/workerPoolV2.ts` - Dynamic worker pool implementation - New: `src/workerPoolInterface.ts` - Common interface for worker pools - New: `src/tests/workerPoolV2.test.ts` - Test suite - New: `docker/test-graceful-shutdown.sh` - Docker test script - Modified: `src/config.ts` - New configuration options - Modified: `src/index.ts` - Graceful shutdown integration - Modified: `src/workerPool.ts` - Added monitoring methods - Modified: `README.md` - Documentation updates - Modified: `.env.example` - Configuration examples - Modified: `docker/docker-compose.yml` - Graceful drain examples ### ✅ Checklist - [x] Worker Pool V2 implemented and tested - [x] Graceful drain configuration added - [x] Docker graceful shutdown tested - [x] All tests passing (77/77) - [x] Documentation updated - [x] Environment variables documented - [x] Backward compatibility maintained --- Closes #14 Closes #15 Closes #16 Closes #17 Closes #20 **Full Changelog**: [dev...release](https://github.com/NiXTheDev/regexYbot/compare/release...dev)
NiXTheDev commented 2026-02-13 17:49:35 +03:00 (Migrated from github.com)

Closing to recreate with correct merge method

Closing to recreate with correct merge method
Sign in to join this conversation.
No description provided.