v0.14.rc1 (2024-09-22)
Improvements:
- Authentication: To support OIDC and regular Cloudtasker authentication, we moved the Cloudtasker Authentication header from
Authorization
toX-Cloudtasker-Authorization
. Backward compatibility is maintained for existing jobs. - Authentication: Use signature-based authentication instead of plain tokens. The authentication token now HMACs the content of the job. This approach prevents token from being reused.
- Batch Jobs: Batch job progress and statistics are now calculated using counters, instead of checking every job. This is much faster.
- Cron Validation: The cron jobs extension now fails epicly if the cron configuration is invalid, instead of failing silently.
- GCP OIDC Authentification: It is now possible to specify an Open ID Connect (OIDC) service account to run Cloudtasker on private Cloud Run services. OIDC authentication is provided as an extra authentication layer on top of the regular Cloudtasker authentication system (see below). See the OIDC section in the initializer documentation.
- Job Execution Control: Add ability to conditionally raise
Cloudtasker::RetryWorkerError
to retry jobs. This error does not get logged but the retry count will still be increased. This is a safer approach than using thereenqueue
helper, which can lead to forever running jobs if not used properly. Documentation. - Log Arguments Truncation: Add
Cloudtasker::WorkerLogger.truncate
helper to truncate large payloads. This is useful to log the top-level attributes of hash/array payloads, without logging the full depth. This case save you significant $$ in logging costs. Documentation. - Storable Jobs: Add an interface to park Cloudtasker jobs that need to be conditionally run later. This is useful when you need to capture jobs (and their arguments) during a batch but only enqueue them after the batch is completed. This extension requires Redis and is provided as an optional module. Documentation.
- Local Server: Add ability to disable SSL verification on the local server when local HTTPS endpoints are used. See the
local_server_ssl_verify
section in the initializer documentation.
Fixed bugs:
- ActiveJob: Support
enqueue_after_transaction_commit?
to be ISO with the ActiveJob interface. - Batch Jobs: Do not register batch jobs that were not actually enqueued due to other factors (e.g. Job Uniqueness extension). This issue could lead to never-ending batches.
- Duration Logging: Specify the unit (
s
for seconds) on the job duration attribute so it gets properly picked up by GCP Logging. GCP Logging was occasionally mixing up seconds and milliseconds. - Job Retry Count: GCP fixed their retry count header some time ago. We now use the
X-CloudTasks-TaskExecutionCount
header instead of theX-CloudTasks-TaskRetryCount
. See more details here. - Rails: Use
skip_forgery_protection
instead ofskip_before_action
. The later was causing occasional issues on some setups.
v0.13.2 (2023-07-02)
Fixed bugs:
- Fix concurrency issue when draining test jobs in
fake!
mode
v0.13.1 (2023-06-19)
Fixed bugs:
- Batch jobs: Gracefully handle errors (e.g. Redis connection error) while setting up child jobs. Previously this could lead to ghost child jobs preventing the parent batch from finishing (child job is registered but is never enqueued)
- Protobuf: fix formatting of protobuf payload by removig
nil
values and formatting thedispatch_deadline
as a properGoogle::Protobuf::Duration
(instead ofinteger
). Fixes #94
v0.13.0 (2022-03-11)
Improvements:
- Dependencies: add support for google-cloud-tasks v2 and while keeping backward compatibility with v1. For existing projects, you may need to run
bundle update google-cloud-tasks
after upgrading cloudtasker to update google-cloud-tasks to the latest version. - Ruby 3: Rework method arguments to be compatible with Ruby 3
- Tests: Separate test environment for Ruby 2 and Ruby 3
- Tests: Do not load Rails by default and skip Rails-specific tests in non-Rails appraisals
v0.12.2 (2021-12-31)
Fixed bugs:
- Local server: Fix race condition on thread processing. See #46
- Non-Rails: Fix
arguments_missing?
check for non-rails projects.
v0.12.1 (2021-08-25)
Fixed bugs:
- Dependencies: Require
try
fromactivesupport
. This was preventing non-Rails projects from properly running Cloudtasker jobs. - WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes #40
v0.11.1 (2021-08-25)
Fixed bugs:
- Dependencies: Require
try
fromactivesupport
. This was preventing non-Rails projects from properly running Cloudtasker jobs. - WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes #40
v0.10.2 (2021-08-25)
Fixed bugs:
- Dependencies: Require
try
fromactivesupport
. This was preventing non-Rails projects from properly running Cloudtasker jobs. - WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes #40
v0.9.5 (2021-08-25)
Fixed bugs:
- Dependencies: Require
try
fromactivesupport
. This was preventing non-Rails projects from properly running Cloudtasker jobs. - WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes #40
v0.12.0 (2021-08-19)
Improvements:
- ActiveJob: do not double log errors (ActiveJob has its own error logging)
- Batch callbacks: Retry jobs when completion callback fails
- Batch state: use native Redis hashes to store batch state instead of a serialized hash in a string key
- Batch progress: restrict calculation to direct children by default. Allow depth to be specified. Calculating progress using all tree jobs created significant delays on large batches.
- Batch redis usage: cleanup batches as they get completed or become dead to avoid excessive redis usage with large batches.
- Batch expansion: Inject
parent_batch
in jobs. Can be used to expand the parent batch the job is in. - Configuration: allow configuration of Cloud Tasks
dispatch deadline
at global and worker level - Configuration: allow specifying global
on_error
andon_dead
callbacks for error reporting - Cron jobs: Use Redis Sets instead of key pattern matching for resource listing
- Error logging: Use worker logger so as to include context (job args etc.)
- Error logging: Do not log exception and stack trace separately, combine them instead.
- Local server: Use Redis Sets instead of key pattern matching for resource listing
- Local server: Guard against nil tasks to prevent job daemon failures
- Performance: remove use of redis locks and rely on atomic transactions instead for Batch and Unique Job.
- Worker: raise DeadWorkerError instead of MissingWorkerArgumentsError when arguments are missing. This is more consistent with what middlewares expect.
- Worker redis usage: delete redis payload storage once the job is successful or dead instead of expiring the key.
Fixed bugs:
- Retries: Enforce job retry limit on job processing. There was an edge case where jobs could be retried indefinitely on batch callback errors.
v0.11.0 (2020-11-23)
Improvements:
- Worker: drop job (return 205 response) when worker arguments are not available (e.g. arguments were stored in Redis and the latter was flushed)
- Rails: add ActiveJob adapter (thanks @vovimayhem)
v0.10.1 (2020-10-05)
Fixed bugs:
- Local server: delete dead task from local server queue
- Logging: fix log processing with
semantic_logger
v4.7.2
. Accept any args on block passed to the logger. - Worker: fix configuration of
max_retries
at worker level
v0.10.0 (2020-09-02)
Improvements:
- Logging: Add worker name in log messages
- Logging: Add job duration in log messages
- Logging: Add Cloud Cloud Task ID in log messages
- Unique Job: Support TTL for lock keys. This feature prevents queues from being dead-locked when a critical crash occurs while processing a unique job.
- Worker: support payload storage in Redis instead of sending the payload to Google Cloud Tasks. This is useful when job arguments are expected to exceed 100kb, which is the limit set by Google Cloud Tasks
Fixed bugs:
- Local processing error: improve error handling and retries around network interruptions
- Redis client: prevent deadlocks in high concurrency scenario by slowing down poll time and enforcing lock expiration
- Redis client: use connecion pool with Redis to prevent race conditions
- Google API: improve error handling on job creation
- Google API: use the
X-CloudTasks-TaskRetryCount
instead ofX-CloudTasks-TaskExecutionCount
to detect how many retries Google Cloud Tasks has performed. UsingX-CloudTasks-TaskRetryCount
is theoretically less accurate than usingX-CloudTasks-TaskExecutionCount
because it includes the number of "app unreachable" retries butX-CloudTasks-TaskExecutionCount
is currently bugged and remains at zero all the time. See this issue
v0.9.4 (2020-10-05)
Fixed bugs:
- Logging: fix log processing with
semantic_logger
v4.7.2
. Accept any args on block passed to the logger.
v0.9.3 (2020-06-25)
Fixed bugs:
- Google Cloud Tasks: lock version to
~> 1.0
(Google recently released a v2 which changes its bindings completely). An issue has been raised to upgrade Cloudtasker togoogle-cloud-tasks
v2
.
v0.9.2 (2020-03-04)
Fixed bugs:
- Cloud Task: ignore "not found" errors when trying to delete an already deleted task.
v0.9.1 (2020-02-11)
Fixed bugs:
- Cloud Task: raise
Cloudtasker::MaxTaskSizeExceededError
if job payload exceeds 100 KB. This is mainly to have production parity in development when running the local processing server.
v0.9.0 (2020-01-23)
Fixed bugs:
- Cloud Task: Base64 encode task body to support UTF-8 characters (e.g. emojis).
- Redis: Restrict to one connection (class level) to avoid too many DNS lookups
Migration For Sinatra applications please update your Cloudtasker controller according to this diff.
v0.8.2 (2019-12-05)
Fixed bugs:
- Config: do not add processor host to
Rails.application.config.hosts
if originally empty.
v0.8.1 (2019-12-03)
Fixed bugs:
- Local dev server: ensure job queue name is kept when taks is retried
- Rails/Controller: bypass Rails munge logic to preserve nil values inside job arguments.