2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-25 23:32:17 +08:00
asynq/CHANGELOG.md

492 lines
16 KiB
Markdown
Raw Normal View History

2020-01-05 05:24:09 +08:00
# Changelog
All notable changes to this project will be documented in this file.
The format is based on ["Keep a Changelog"](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
2022-01-29 18:02:52 +08:00
### Added
2022-02-10 17:56:34 +08:00
- `BaseContext` is introduced in `Config` to specify callback hook to provide a base `context` from which `Handler` `context` is derived
2022-01-29 18:02:52 +08:00
### Changed
- `Server` now recovers tasks with an expired lease. Recovered tasks are retried/archived with `ErrLeaseExpired` error.
2022-01-22 22:15:29 +08:00
## [0.21.0] - 2022-01-22
### Added
2022-01-22 22:14:24 +08:00
- `PeriodicTaskManager` is added. Prefer using this over `Scheduler` as it has better support for dynamic periodic tasks.
- The `asynq stats` command now supports a `--json` option, making its output a JSON object
- Introduced new configuration for `DelayedTaskCheckInterval`. See [godoc](https://godoc.org/github.com/hibiken/asynq) for more details.
2021-12-19 23:00:21 +08:00
## [0.20.0] - 2021-12-19
### Added
- Package `x/metrics` is added.
- Tool `tools/metrics_exporter` binary is added.
2021-12-17 08:53:02 +08:00
- `ProcessedTotal` and `FailedTotal` fields were added to `QueueInfo` struct.
2021-12-12 22:16:13 +08:00
## [0.19.1] - 2021-12-12
2021-11-16 08:34:26 +08:00
### Added
2021-12-11 22:44:01 +08:00
- `Latency` field is added to `QueueInfo`.
2021-11-16 08:34:26 +08:00
- `EnqueueContext` method is added to `Client`.
### Fixed
- Fixed an error when user pass a duration less than 1s to `Unique` option
2021-11-07 06:20:09 +08:00
## [0.19.0] - 2021-11-06
### Changed
- `NewTask` takes `Option` as variadic argument
- Bumped minimum supported go version to 1.14 (i.e. go1.14 or higher is required).
### Added
- `Retention` option is added to allow user to specify task retention duration after completion.
- `TaskID` option is added to allow user to specify task ID.
- `ErrTaskIDConflict` sentinel error value is added.
- `ResultWriter` type is added and provided through `Task.ResultWriter` method.
- `TaskInfo` has new fields `CompletedAt`, `Result` and `Retention`.
### Removed
- `Client.SetDefaultOptions` is removed. Use `NewTask` instead to pass default options for tasks.
2021-10-03 20:55:49 +08:00
## [0.18.6] - 2021-10-03
### Changed
- Updated `github.com/go-redis/redis` package to v8
## [0.18.5] - 2021-09-01
2021-09-01 21:02:49 +08:00
### Added
- `IsFailure` config option is added to determine whether error returned from Handler counts as a failure.
2021-10-03 20:55:49 +08:00
## [0.18.4] - 2021-08-17
2021-08-18 08:12:33 +08:00
2021-08-17 11:22:43 +08:00
### Fixed
- Scheduler methods are now thread-safe. It's now safe to call `Register` and `Unregister` concurrently.
2021-10-03 20:55:49 +08:00
## [0.18.3] - 2021-08-09
2021-08-09 23:59:35 +08:00
### Changed
- `Client.Enqueue` no longer enqueues tasks with empty typename; Error message is returned.
2021-10-03 20:55:49 +08:00
## [0.18.2] - 2021-07-15
2021-07-15 21:56:53 +08:00
### Changed
- Changed `Queue` function to not to convert the provided queue name to lowercase. Queue names are now case-sensitive.
- `QueueInfo.MemoryUsage` is now an approximate usage value.
### Fixed
- Fixed latency issue around memory usage (see https://github.com/hibiken/asynq/issues/309).
2021-10-03 20:55:49 +08:00
## [0.18.1] - 2021-07-04
2021-07-04 21:39:54 +08:00
2021-07-04 21:24:44 +08:00
### Changed
- Changed to execute task recovering logic when server starts up; Previously it needed to wait for a minute for task recovering logic to exeucte.
### Fixed
- Fixed task recovering logic to execute every minute
2021-07-04 21:39:54 +08:00
## [0.18.0] - 2021-06-29
2021-06-30 07:36:52 +08:00
### Changed
2021-03-21 04:42:13 +08:00
- NewTask function now takes array of bytes as payload.
- Task `Type` and `Payload` should be accessed by a method call.
- `Server` API has changed. Renamed `Quiet` to `Stop`. Renamed `Stop` to `Shutdown`. _Note:_ As a result of this renaming, the behavior of `Stop` has changed. Please update the exising code to call `Shutdown` where it used to call `Stop`.
- `Scheduler` API has changed. Renamed `Stop` to `Shutdown`.
- Requires redis v4.0+ for multiple field/value pair support
- `Client.Enqueue` now returns `TaskInfo`
- `Inspector.RunTaskByKey` is replaced with `Inspector.RunTask`
- `Inspector.DeleteTaskByKey` is replaced with `Inspector.DeleteTask`
- `Inspector.ArchiveTaskByKey` is replaced with `Inspector.ArchiveTask`
- `inspeq` package is removed. All types and functions from the package is moved to `asynq` package.
- `WorkerInfo` field names have changed.
- `Inspector.CancelActiveTask` is renamed to `Inspector.CancelProcessing`
2021-06-06 21:51:30 +08:00
## [0.17.2] - 2021-06-06
### Fixed
- Free unique lock when task is deleted (https://github.com/hibiken/asynq/issues/275).
2021-04-05 03:51:00 +08:00
## [0.17.1] - 2021-04-04
### Fixed
- Fix bug in internal `RDB.memoryUsage` method.
2021-03-25 07:51:59 +08:00
## [0.17.0] - 2021-03-24
### Added
- `DialTimeout`, `ReadTimeout`, and `WriteTimeout` options are added to `RedisConnOpt`.
2021-03-20 21:27:03 +08:00
## [0.16.1] - 2021-03-20
### Fixed
- Replace `KEYS` command with `SCAN` as recommended by [redis doc](https://redis.io/commands/KEYS).
2021-03-11 12:39:46 +08:00
## [0.16.0] - 2021-03-10
2020-11-08 02:41:27 +08:00
### Added
- `Unregister` method is added to `Scheduler` to remove a registered entry.
2021-01-31 22:11:17 +08:00
## [0.15.0] - 2021-01-31
**IMPORTATNT**: All `Inspector` related code are moved to subpackage "github.com/hibiken/asynq/inspeq"
### Changed
- `Inspector` related code are moved to subpackage "github.com/hibken/asynq/inspeq".
2021-01-29 22:37:35 +08:00
- `RedisConnOpt` interface has changed slightly. If you have been passing `RedisClientOpt`, `RedisFailoverClientOpt`, or `RedisClusterClientOpt` as a pointer,
2020-11-08 02:41:27 +08:00
update your code to pass as a value.
- `ErrorMsg` field in `RetryTask` and `ArchivedTask` was renamed to `LastError`.
### Added
- `MaxRetry`, `Retried`, `LastError` fields were added to all task types returned from `Inspector`.
- `MemoryUsage` field was added to `QueueStats`.
- `DeleteAllPendingTasks`, `ArchiveAllPendingTasks` were added to `Inspector`
- `DeleteTaskByKey` and `ArchiveTaskByKey` now supports deleting/archiving `PendingTask`.
- asynq CLI now supports deleting/archiving pending tasks.
2021-01-19 22:22:54 +08:00
## [0.14.1] - 2021-01-19
### Fixed
- `go.mod` file for CLI
2021-01-14 22:49:36 +08:00
## [0.14.0] - 2021-01-14
2021-01-13 03:28:46 +08:00
**IMPORTATNT**: Please run `asynq migrate` command to migrate from the previous versions.
### Changed
- Renamed `DeadTask` to `ArchivedTask`.
- Renamed the operation `Kill` to `Archive` in `Inpsector`.
2021-01-14 22:26:01 +08:00
- Print stack trace when Handler panics.
- Include a file name and a line number in the error message when recovering from a panic.
2021-01-13 03:28:46 +08:00
2020-12-01 23:39:27 +08:00
### Added
2021-01-13 03:40:26 +08:00
- `DefaultRetryDelayFunc` is now a public API, which can be used in the custom `RetryDelayFunc`.
- `SkipRetry` error is added to be used as a return value from `Handler`.
- `Servers` method is added to `Inspector`
- `CancelActiveTask` method is added to `Inspector`.
- `ListSchedulerEnqueueEvents` method is added to `Inspector`.
2020-12-01 23:39:27 +08:00
- `SchedulerEntries` method is added to `Inspector`.
- `DeleteQueue` method is added to `Inspector`.
2020-11-23 04:26:52 +08:00
## [0.13.1] - 2020-11-22
### Fixed
- Fixed processor to wait for specified time duration before forcefully shutdown workers.
2020-10-13 21:33:47 +08:00
## [0.13.0] - 2020-10-13
2020-10-12 21:47:43 +08:00
### Added
- `Scheduler` type is added to enable periodic tasks. See the godoc for its APIs and [wiki](https://github.com/hibiken/asynq/wiki/Periodic-Tasks) for the getting-started guide.
### Changed
2020-10-12 21:47:43 +08:00
- interface `Option` has changed. See the godoc for the new interface.
This change would have no impact as long as you are using exported functions (e.g. `MaxRetry`, `Queue`, etc)
to create `Option`s.
### Added
2021-01-13 03:28:46 +08:00
- `Payload.String() string` method is added
- `Payload.MarshalJSON() ([]byte, error)` method is added
2020-09-13 04:34:27 +08:00
## [0.12.0] - 2020-09-12
2021-01-13 03:28:46 +08:00
**IMPORTANT**: If you are upgrading from a previous version, please install the latest version of the CLI `go get -u github.com/hibiken/asynq/tools/asynq` and run `asynq migrate` command. No process should be writing to Redis while you run the migration command.
2020-09-13 03:55:09 +08:00
## The semantics of queue have changed
2021-01-13 03:28:46 +08:00
Previously, we called tasks that are ready to be processed _"Enqueued tasks"_, and other tasks that are scheduled to be processed in the future _"Scheduled tasks"_, etc.
We changed the semantics of _"Enqueue"_ slightly; All tasks that client pushes to Redis are _Enqueued_ to a queue. Within a queue, tasks will transition from one state to another.
2020-09-13 03:55:09 +08:00
Possible task states are:
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
- `Pending`: task is ready to be processed (previously called "Enqueued")
- `Active`: tasks is currently being processed (previously called "InProgress")
- `Scheduled`: task is scheduled to be processed in the future
- `Retry`: task failed to be processed and will be retried again in the future
- `Dead`: task has exhausted all of its retries and stored for manual inspection purpose
**These semantics change is reflected in the new `Inspector` API and CLI commands.**
---
### Changed
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
#### `Client`
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
Use `ProcessIn` or `ProcessAt` option to schedule a task instead of `EnqueueIn` or `EnqueueAt`.
| Previously | v0.12.0 |
2021-01-13 03:28:46 +08:00
| --------------------------- | ------------------------------------------ |
| `client.EnqueueAt(t, task)` | `client.Enqueue(task, asynq.ProcessAt(t))` |
| `client.EnqueueIn(d, task)` | `client.Enqueue(task, asynq.ProcessIn(d))` |
2020-09-13 03:55:09 +08:00
#### `Inspector`
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
All Inspector methods are scoped to a queue, and the methods take `qname (string)` as the first argument.
`EnqueuedTask` is renamed to `PendingTask` and its corresponding methods.
`InProgressTask` is renamed to `ActiveTask` and its corresponding methods.
Command "Enqueue" is replaced by the verb "Run" (e.g. `EnqueueAllScheduledTasks` --> `RunAllScheduledTasks`)
#### `CLI`
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
CLI commands are restructured to use subcommands. Commands are organized into a few management commands:
To view details on any command, use `asynq help <command> <subcommand>`.
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
- `asynq stats`
- `asynq queue [ls inspect history rm pause unpause]`
- `asynq task [ls cancel delete kill run delete-all kill-all run-all]`
- `asynq server [ls]`
### Added
#### `RedisConnOpt`
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
- `RedisClusterClientOpt` is added to connect to Redis Cluster.
- `Username` field is added to all `RedisConnOpt` types in order to authenticate connection when Redis ACLs are used.
#### `Client`
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
- `ProcessIn(d time.Duration) Option` and `ProcessAt(t time.Time) Option` are added to replace `EnqueueIn` and `EnqueueAt` functionality.
#### `Inspector`
2021-01-13 03:28:46 +08:00
2020-09-13 03:55:09 +08:00
- `Queues() ([]string, error)` method is added to get all queue names.
- `ClusterKeySlot(qname string) (int64, error)` method is added to get queue's hash slot in Redis cluster.
2021-01-13 03:28:46 +08:00
- `ClusterNodes(qname string) ([]ClusterNode, error)` method is added to get a list of Redis cluster nodes for the given queue.
2020-09-13 03:55:09 +08:00
- `Close() error` method is added to close connection with redis.
2021-01-13 03:28:46 +08:00
### `Handler`
2020-09-13 03:55:09 +08:00
- `GetQueueName(ctx context.Context) (string, bool)` helper is added to extract queue name from a context.
2020-07-29 13:46:41 +08:00
## [0.11.0] - 2020-07-28
2020-07-29 13:45:22 +08:00
### Added
- `Inspector` type was added to monitor and mutate state of queues and tasks.
- `HealthCheckFunc` and `HealthCheckInterval` fields were added to `Config` to allow user to specify a callback
function to check for broker connection.
2020-07-06 20:53:56 +08:00
## [0.10.0] - 2020-07-06
2020-06-24 20:42:06 +08:00
### Changed
- All tasks now requires timeout or deadline. By default, timeout is set to 30 mins.
- Tasks that exceed its deadline are automatically retried.
2021-01-13 03:28:46 +08:00
- Encoding schema for task message has changed. Please install the latest CLI and run `migrate` command if
2020-07-04 20:24:47 +08:00
you have tasks enqueued with the previous version of asynq.
- API of `(*Client).Enqueue`, `(*Client).EnqueueIn`, and `(*Client).EnqueueAt` has changed to return a `*Result`.
2020-07-04 20:24:47 +08:00
- API of `ErrorHandler` has changed. It now takes context as the first argument and removed `retried`, `maxRetry` from the argument list.
Use `GetRetryCount` and/or `GetMaxRetry` to get the count values.
2020-06-24 20:42:06 +08:00
2020-06-13 21:27:28 +08:00
## [0.9.4] - 2020-06-13
### Fixed
- Fixes issue of same tasks processed by more than one worker (https://github.com/hibiken/asynq/issues/90).
2020-06-12 21:31:42 +08:00
## [0.9.3] - 2020-06-12
### Fixed
- Fixes the JSON number overflow issue (https://github.com/hibiken/asynq/issues/166).
2020-06-08 21:23:02 +08:00
## [0.9.2] - 2020-06-08
2020-06-08 21:15:45 +08:00
### Added
- The `pause` and `unpause` commands were added to the CLI. See README for the CLI for details.
2020-05-29 20:42:40 +08:00
## [0.9.1] - 2020-05-29
### Added
- `GetTaskID`, `GetRetryCount`, and `GetMaxRetry` functions were added to extract task metadata from context.
2020-05-16 23:02:57 +08:00
## [0.9.0] - 2020-05-16
2020-05-10 22:14:05 +08:00
### Changed
- `Logger` interface has changed. Please see the godoc for the new interface.
### Added
- `LogLevel` type is added. Server's log level can be specified through `LogLevel` field in `Config`.
2020-05-08 21:19:48 +08:00
## [0.8.3] - 2020-05-08
### Added
- `Close` method is added to `Client`.
2020-05-04 07:55:34 +08:00
## [0.8.2] - 2020-05-03
2020-05-04 07:47:55 +08:00
### Fixed
- [Fixed cancelfunc leak](https://github.com/hibiken/asynq/pull/145)
2020-04-27 21:49:12 +08:00
## [0.8.1] - 2020-04-27
2020-03-26 22:31:08 +08:00
### Added
- `ParseRedisURI` helper function is added to create a `RedisConnOpt` from a URI string.
2020-04-26 22:48:38 +08:00
- `SetDefaultOptions` method is added to `Client`.
2020-03-26 22:31:08 +08:00
2020-04-20 00:08:20 +08:00
## [0.8.0] - 2020-04-19
2020-04-13 08:16:44 +08:00
### Changed
- `Background` type is renamed to `Server`.
2020-04-19 03:37:24 +08:00
- To upgrade from the previous version, Update `NewBackground` to `NewServer` and pass `Config` by value.
2020-04-13 08:16:44 +08:00
- CLI is renamed to `asynq`.
2020-04-19 03:37:24 +08:00
- To upgrade the CLI to the latest version run `go get -u github.com/hibiken/tools/asynq`
2020-04-13 08:16:44 +08:00
- The `ps` command in CLI is renamed to `servers`
- `Concurrency` defaults to the number of CPUs when unset or set to a negative value.
2020-04-13 08:16:44 +08:00
2020-04-19 03:37:24 +08:00
### Added
- `ShutdownTimeout` field is added to `Config` to speicfy timeout duration used during graceful shutdown.
- New `Server` type exposes `Start`, `Stop`, and `Quiet` as well as `Run`.
2020-04-06 05:56:06 +08:00
## [0.7.1] - 2020-04-05
### Fixed
- Fixed signal handling for windows.
2020-03-23 03:04:37 +08:00
## [0.7.0] - 2020-03-22
### Changed
- Support Go v1.13+, dropped support for go v1.12
### Added
- `Unique` option was added to allow client to enqueue a task only if it's unique within a certain time period.
2020-03-16 12:02:28 +08:00
## [0.6.2] - 2020-03-15
2020-03-14 05:38:45 +08:00
### Added
- `Use` method was added to `ServeMux` to apply middlewares to all handlers.
2020-03-12 23:42:18 +08:00
## [0.6.1] - 2020-03-12
### Added
- `Client` can optionally schedule task with `asynq.Deadline(time)` to specify deadline for task's context. Default is no deadline.
2020-03-12 23:42:18 +08:00
- `Logger` option was added to config, which allows user to specify the logger used by the background instance.
2020-03-02 07:54:59 +08:00
## [0.6.0] - 2020-03-01
2020-03-01 13:34:12 +08:00
### Added
- Added `ServeMux` type to make it easy for users to implement Handler interface.
2020-03-01 13:34:12 +08:00
- `ErrorHandler` type was added. Allow users to specify error handling function (e.g. Report error to error reporting service such as Honeybadger, Bugsnag, etc)
2020-02-24 12:44:03 +08:00
## [0.5.0] - 2020-02-23
### Changed
- `Client` API has changed. Use `Enqueue`, `EnqueueAt` and `EnqueueIn` to enqueue and schedule tasks.
2020-02-23 13:06:02 +08:00
### Added
- `asynqmon workers` was added to list all running workers information
2020-02-13 22:25:27 +08:00
## [0.4.0] - 2020-02-13
2020-02-13 10:11:59 +08:00
### Changed
- `Handler` interface has changed. `ProcessTask` method takes two arguments `context.Context` and `*asynq.Task`
2020-02-13 22:17:47 +08:00
- `Queues` field in `Config` has change from `map[string]uint` to `map[string]int`
2020-02-13 10:11:59 +08:00
### Added
- `Client` can optionally schedule task with `asynq.Timeout(duration)` to specify timeout duration for task. Default is no timeout.
- `asynqmon cancel [task id]` will send a cancelation signal to the goroutine processing the speicified task.
2020-02-04 22:29:57 +08:00
## [0.3.0] - 2020-02-04
2020-02-03 12:59:00 +08:00
### Added
- `asynqmon ps` was added to list all background worker processes
2020-01-27 08:07:44 +08:00
## [0.2.2] - 2020-01-26
### Fixed
- Fixed restoring unfinished tasks back to correct queues.
### Changed
- `asynqmon ls` command is now paginated (default 30 tasks from first page)
- `asynqmon ls enqueued:[queue name]` requires queue name to be specified
2020-01-22 22:45:16 +08:00
## [0.2.1] - 2020-01-22
### Fixed
- More structured log messages
- Prevent spamming logs with a bunch of errors when Redis connection is lost
- Fixed and updated README doc
2020-01-20 07:28:24 +08:00
## [0.2.0] - 2020-01-19
### Added
- NewTask constructor
2020-01-08 13:53:38 +08:00
- `Queues` option in `Config` to specify mutiple queues with priority level
- `Client` can schedule a task with `asynq.Queue(name)` to specify which queue to use
2020-01-12 23:46:51 +08:00
- `StrictPriority` option in `Config` to specify whether the priority should be followed strictly
2020-01-17 12:54:36 +08:00
- `RedisConnOpt` to abstract away redis client implementation
2020-01-14 22:05:21 +08:00
- [CLI] `asynqmon rmq` command to remove queue
### Changed
2020-01-17 12:54:36 +08:00
- `Client` and `Background` constructors take `RedisConnOpt` as their first argument.
2020-01-20 07:28:24 +08:00
- `asynqmon stats` now shows the total of all enqueued tasks under "Enqueued"
- `asynqmon stats` now shows each queue's task count
- `asynqmon history` now doesn't take any arguments and shows data from the last 10 days by default (use `--days` flag to change the number of days)
- Task type is now immutable (i.e., Payload is read-only)
2020-01-05 05:24:09 +08:00
## [0.1.0] - 2020-01-04
### Added
- Initial version of asynq package
- Initial version of asynqmon CLI