The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Mosquito::Api now allows for inspecting the state of the state of a mosquito cluster. Many of these features are disabled by default by the configuration property
config.publish_metrics.- Executor api implemented in #147
- JobRun api implemented in #148 and #161
- Overseer api implemented in #150
- Queue api implemented in #153
- Mosquito now publishes a variety of events and metrics to a redis pubsub channel. This behavior is disabled by default with the configuration property
config.publish_metrics.- Executor events in #154: job-started and job-finished
- Overseer events in #160: starting, executor-created, executor-died, stopping, and stopped
- Queue events: enqueue, dequeue, reschedule, forget, and banish
- Expected job duration is now published with executor events
The Mosquito API can be used to subscribe to these events with
Mosquito::API.event_receiver
- Pluggable dequeue adapters allow customizing how jobs are selected from queues (#183)
DequeueAdapterabstract base class defines the adapter interfaceShuffleDequeueAdapteris the default, preserving existing randomized behaviorWeightedDequeueAdapterallows queue-level prioritization via configurable weights- Configurable via
Mosquito.configure { |c| c.dequeue_adapter = ... }
- Executor count is now configurable (default increased from 3 to 6) (#184)
- Set via
Mosquito.configure { |c| c.executor_count = 10 } - Override with the
MOSQUITO_EXECUTOR_COUNTenvironment variable
- Set via
JobRun#started_atandJobRun#finished_attimestamps are now exposed as typedTime?getters (#179)- Graceful worker shutdown: on SIGTERM/SIGINT the overseer stops dequeuing, waits for in-flight executors to finish, and requeues any jobs left in pending back to waiting (#190)
- Queues can now be paused and resumed. While paused,
#dequeuereturns nil and jobs accumulate until the queue is resumed. An optional duration enables automatic resumption, useful for backing off rate-limited resources. (#192) - Overseers now take ownership of job runs when dequeued, and clean up abandoned pending job runs on startup (#180)
- Mosquito can now accept pre-existing backend connections via
Configuration#backend_connection. This allows sharing a connection pool with the rest of an application. (#193) - JobRun now uses Metadata for all backend storage operations, replacing direct backend calls with the Metadata abstraction layer.
Mosquito::UniqueJobmodule provides opt-in job deduplication. Including the module in a job class prevents enqueueing duplicate jobs when an identical job is already waiting or scheduled. Uniqueness keys are derived from job parameters at compile time.
- (breaking)
Configuration#connection_stringhas been renamed toConfiguration#backend_connection_string(#193) - (minor breaking) Logs are now emitted from runners with a slighly different source tag. (#152)
For example:
The overseer boot message used to be:
INFO - mosquito.runners.overseer.4315742080: Overseer<4315742080> is startingNow the message is simply:INFO - mosquito.overseer: starting - Mosquito now runs CI checks for compatibility with Crystal 1.6
- The coordinator now uses UTC time instead of monotonic time
- Fixed a KeyError crash in the demo when job metadata was missing by using safe key access.
- the queue_list runner was never being shut down, but it is now as of (#165)
- Fixed a bug which would cause a mosquito server to hang at exit indefinitely if a job was mid-run during an interrupt. (#165)
- Fixed a bug which would cause a correctly exiting server to prematurely exit without emitting shutdown sequence logs and events. (#165)
- Crashed executors are now properly detected and replaced, preventing overseers from running with no executors
- Overseer now correctly deregisters on clean exit
- Pubsub logging now uses the
mosquito.eventsnamespace instead of the rootmosquitonamespace - Queue
@emptylatch no longer permanently prevents re-dequeue after a queue drains - Observer functionality is correctly gated behind the
publish_metricsconfig flag - Executor events are correctly scoped to within the overseer
- Fixed a latent bug which caused job duration to be reported incorrectly
- Fixed
Mosquito::Api.list_queues
- Optimized
metadata#setto decrease the number of redis commands
- Adds a test backend, which can be used to inspect jobs that were enqueued and the parameters they were enqueued with.
- Job#fail now takes an optional
retryparameter which defaults to true, allowing a developer to explicitly mark a job as not retry-able during a job run. Additionally ashould_retryproperty exists which can be set as well. - Mosquito::Configuration now provides
global_prefixto change the global Redis namespace prefix, allowing for more than one mosquito app to share a redis instance (thanks @dammer, cf #134).
- PeriodicJobs are now correctly run once per interval in an environment with many workers.
- Running more than ~10 workers no longer causes workers to crash, fixing #137 (cf #138).
- Mosquito is now more broadly compatible with jgaskins redis, swapping 0.7.0 for 0.7, and forward compatible through 0.8. (thanks @rmarronnier)
- Mosquito now more gracefully responds to SIGTERM, fixes #122, cf #123.
- High CPU usage on linux is no longer an issue, fixes #126, cf #128.
- The QueuedJob
paramsmacro has been replaced withparamwhich declares only one parameter at a time. - JobRun#delete now explicitly takes an Int, rather than simply defaulting to 0 (thanks @jwoertink, cf #136).
- removes deprecated Backend.delete(String, Int32), use Backend.delete(String, Int64) instead.
- removes deprecated Queue#length, use Queue#size instead.
- removes option to run the cron scheduler declaratively, it is now always on with a distributed lock.
- Dramatically decreases the time spent listing queues #120
- Replaces #keys with #scan_each to list runners #138
- Provides for multiple executors operating under a single runner #123
- Mosquito::Runner.start now captures the thread with a spin lock again. The new behavior of returning imediately can be achieved by calling #start(spin: false)
- Implements a distributed lock for scheduler coordination. The behavior is opt-in for now, but will become the default in the next release. See #108.
- Provides a helpful error message for most implementation errors dealing with declaring params.
- Mosquito::QueuedJob: the
paramsmacro has been deprecated in favor ofparam. See #110. - The deprecated Redis command
rpoplpushis no longer used. This lifts the minimum redis server requirement up to 6.2.0 and jgaskins redis to > 0.7.0. - Mosquito::Runner.start no longer captures the thread with a spin lock. [DEFECT]
- Mosquito config option
run_cron_scheduleris no longer present, multiple workers will compete for a distributed lock instead. See #108.
- Jobs can now specify their retry/reschedule logic with the #rescheduleable? and #reschedule_interval methods.
- Job metadata storage engine.
- Jobs can now specify
afterhooks. - Mosquito::Runner now has a
stopmethod which halts the runner after completion of any running tasks. See issue #21 and pull #87. - Mosquito config option
run_cron_scheduleris no longer present, multiple workers will compete for a distributed lock instead.
- The storage backend is now implemented via interface, allowing alternate backends to be implemented.
- The rate limiting functionality is now implemented in a module,
Mosquito::RateLimiter. See pull #77 for migration details. - ** BREAKING **
Job.job_typehas been replaced withJob.queue_name. The functionailty is identical but easier to access. See #86. logstatements now properly identify where they're coming from rather than just 'mosquito'. See issue #78 and pull #88.- Mosquito now connects to Redis using a connection pool. See #89
- ** BREAKING **
Mosquito.settingsis nowMosquito.configuration. While this is technically a public API, it's unlikely anyone is using it for anything. - Mosquito::Runner.start need not be called from a spawn, it will spawn on it's own.
- Runner.idle_wait configuration is deprecated. Instead use Mosquito.configure#idle_wait.
- Built in serializer for Granite models, and the Model type alias. See Serializers in the documentation if the functionality is necessary.
- Mosquito no longer depends on luckyframework/habitat.
- Boolean false can now be specified as the default value for a parameter:
params(name = false)
- #66 Jobs with no parameters can now be enqueued without specifying an empty
params(). - #65 PeriodicJobs can now specify their run period in months.
The v0 major version is now bugfix-only. Please update to v1.0. v0 will be supported as long as it's feasible to do so.
- Jobs can now specify
beforehooks, which can abort before the perform is triggered. - The Cron scheduler for periodic jobs can now be disabled via Mosquito.configure#run_cron_scheduler
- The list of queues which are watched by the runner can now be configured via Mosquito.configure#run_from.
- Redis shard 2.8.0, removes hash shims which are no longer needed. Thanks @jwoertink.
Proforma release for Crystal 1.0.
- UUID serializer helpers.
- Switches from Benchmark.measure to Time.measure, thanks @anapsix.
- Runner.idle_wait is now configured via Mosquito.configure instead of directly on Mosquito::Runner.
- Allows redis connection string to be specified via config option, thanks @watzon.
- Connecting to redis via implicit REDIS_URL parameter is deprecated, thanks @watzon.
- (Breaking) Dead tasks which have failed and expired are now cleaned up with a Redis TTL. See Pull #48.
- ability to configure Runner.idle_wait period, thanks @mamantoha.
- Point to Crystal 0.34.0, thanks @alex-lairan.
- Replaces
Loggerwith the more flexibleLog.
- Point to Crystal 0.31.1, 0.32.1.
- Redis version, thanks @nsuchy.
- Issue #26 Unresolved local var error, thanks @blacksmoke16.
- Throttling logic, thanks @blacksmoke16.
- Point to crystal 0.27, thanks @blacksmoke16.
- Brittle/intermittently failing tests.
- Logo, contributed by @psikoz.
- configuration for CI :
make test demowill run all acceptance criteria. - demo section.
- makefile.
- specify crystal 0.26.
- simplify macro logic in QueuedJob.
- Specify crystal-redis 2.0 and crystal 0.25.
- Job classes can now disable rescheduling on failure.
- Readme.
- Misc typo fixes and flexibility upgrades.
- Update Crystal specification 0.23.1 -> .24.2.
- Correctly specify and sync version numbers from shard.yml / version.cr / git tag.
- Use configurable Logger instead of writing directly to stdout.
- Log output is now colorized and formatted to be read by human eyes.
- Breaking: Update Mosquito::Model type alias to match updates to Granite.
- BUG: task id was mutating on each save, causing weird logging when tasks reschedule.
- PERFORMANCE: adding IDLE_WAIT to prevent slamming redis when the queues are empty. Smarter querying of the queues for work.