Skip to content

v0.10.0

Latest

Choose a tag to compare

@route route released this 04 Nov 17:13
· 38 commits to main since this release

Added

  • The web UI's Streams page shows when each stream last received a message
  • limit: { duration:, retry_in: } accept duration strings such as "82m", not only seconds
  • Job.perform_bulk(list) enqueues one job per argument list, pipelining the publishes a thousand at a time
  • Job.set(stream:, retry:, dead:, subject:) overrides job options for a single perform_async/perform_in/perform_at
  • consumers.jobs in cosmo.yml can be a list of groups, flattened on load, to organize consumers by worker fleet
  • setup.cron in cosmo.yml can be a list of groups to organize cron schedules

Changed

  • Breaking: running jobs live in a new _cosmojobs bucket, written by each worker's 10s heartbeat, instead of one
    _cosmobusy write per job. Middleware::Busy and API::Stats::Busy are gone (drop chain.remove Cosmo::Middleware::Busy),
    and _cosmoprocesses keys are now <kind>.<host>.<pid>.<concurrency>. After a rollout, nats kv del _cosmobusy -f

  • The Web UI counts running jobs and processes on the server and reads only the page it shows, instead of watching whole
    buckets on every poll. "Running now" became a "Running sample", and the Busy tab has an "Order by longest" button

  • The sidebar's batch badge counts up to 100 batches by direct get and shows "100+" past that

  • A worker whose shutdown times out releases the messages it's still processing before it exits instead of leaving
    them for ack_wait: a job counts as a failed attempt with Cosmo::JobInterruptedError, retried after its usual
    delay or moved to dead without attempts left; stream messages are NAK'd and redelivered after 10s
    (COSMO_STREAMS_RELEASE_DELAY). The interrupted threads are then killed and get up to 5s to unwind while NATS is
    still connected, so a worker exits right after its shutdown timeout instead of waiting out a JetStream request
    timeout per busy job, and their running-job entries are cleared

  • Breaking: config.replicas is config.services.num_replicas, named like the num_replicas each stream in
    cosmo.yml sets for itself; it only sizes Cosmo's own streams and buckets

  • API::Counter#increment/#incr and #decrement/#decr log a counter that can't be written and return nil;
    #increment!/#incr! and #decrement!/#decr! raise as they used to

  • A job worker skips a configured stream that doesn't exist in NATS with a warning, instead of crashing on boot

  • Breaking: Ruby 3.2 or newer is required, Ruby 3.1 is no longer supported

Fixed

  • The Web UI's ?limit= is kept between 1 and 100: 0 raised, and over 1024 read an empty page
  • A job's limit: { duration: } can't be swallowed by job code rescuing Timeout::Error or StandardError
    anymore; it fails with Cosmo::JobTimeoutError, so the dead stream tells it apart from a Timeout::Error raised by
    the job's own code
  • A job whose class a worker can't load, e.g. mid-deploy, runs through the server middleware with a nil job and
    fails with Cosmo::JobClassNotFoundError, so it is counted and retried as its payload's retry allows instead of
    going straight to dead; a malformed payload still goes straight to dead but counts as failed
  • A cron job takes retry and dead from its job class instead of always the defaults
  • Metrics read a period by start time instead of a multi_last get capped at 1024 subjects
  • Web UI buttons show a pointer cursor and a fill on hover