github.com/wfusion/gofusion@v1.1.14/common/infra/asynq/CHANGELOG.md (about)

     1  # Changelog
     2  
     3  All notable changes to this project will be documented in this file.
     4  
     5  The format is based on ["Keep a Changelog"](https://keepachangelog.com/en/1.0.0/),
     6  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     7  
     8  ## [Unreleased]
     9  
    10  ## [0.24.1] - 2023-05-01
    11  
    12  ### Changed
    13  - Updated package version dependency for go-redis 
    14  
    15  ## [0.24.0] - 2023-01-02
    16  
    17  ### Added
    18  - `PreEnqueueFunc`, `PostEnqueueFunc` is added in `Scheduler` and deprecated `EnqueueErrorHandler` (PR: https://github.com/hibiken/asynq/pull/476)
    19  
    20  ### Changed
    21  - Removed error log when `Scheduler` failed to enqueue a task. Use `PostEnqueueFunc` to check for errors and task actions if needed.
    22  - Changed log level from ERROR to WARNINING when `Scheduler` failed to record `SchedulerEnqueueEvent`.
    23  
    24  ## [0.23.0] - 2022-04-11
    25  
    26  ### Added
    27  
    28  - `Group` option is introduced to enqueue task in a group.
    29  - `GroupAggregator` and related types are introduced for task aggregation feature.
    30  - `GroupGracePeriod`, `GroupMaxSize`, `GroupMaxDelay`, and `GroupAggregator` fields are added to `Config`.
    31  - `Inspector` has new methods related to "aggregating tasks".
    32  - `Group` field is added to `TaskInfo`.
    33  - (CLI): `group ls` command is added
    34  - (CLI): `task ls` supports listing aggregating tasks via `--state=aggregating --group=<GROUP>` flags
    35  - Enable rediss url parsing support
    36  
    37  ### Fixed
    38  
    39  - Fixed overflow issue with 32-bit systems (For details, see https://github.com/hibiken/asynq/pull/426)
    40  
    41  ## [0.22.1] - 2022-02-20
    42  
    43  ### Fixed
    44  
    45  - Fixed Redis version compatibility: Keep support for redis v4.0+
    46  
    47  ## [0.22.0] - 2022-02-19
    48  
    49  ### Added
    50  
    51  - `BaseContext` is introduced in `Config` to specify callback hook to provide a base `context` from which `Handler` `context` is derived
    52  - `IsOrphaned` field is added to `TaskInfo` to describe a task left in active state with no worker processing it.
    53  
    54  ### Changed
    55  
    56  - `Server` now recovers tasks with an expired lease. Recovered tasks are retried/archived with `ErrLeaseExpired` error.
    57  
    58  ## [0.21.0] - 2022-01-22
    59  
    60  ### Added
    61  
    62  - `PeriodicTaskManager` is added. Prefer using this over `Scheduler` as it has better support for dynamic periodic tasks.
    63  - The `asynq stats` command now supports a `--json` option, making its output a JSON object
    64  - Introduced new configuration for `DelayedTaskCheckInterval`. See [godoc](https://godoc.org/github.com/hibiken/asynq) for more details.
    65  
    66  ## [0.20.0] - 2021-12-19
    67  
    68  ### Added
    69  
    70  - Package `x/metrics` is added.
    71  - Tool `tools/metrics_exporter` binary is added.
    72  - `ProcessedTotal` and `FailedTotal` fields were added to `QueueInfo` struct.
    73  
    74  ## [0.19.1] - 2021-12-12
    75  
    76  ### Added
    77  
    78  - `Latency` field is added to `QueueInfo`.
    79  - `EnqueueContext` method is added to `Client`.
    80  
    81  ### Fixed
    82  
    83  - Fixed an error when user pass a duration less than 1s to `Unique` option
    84  
    85  ## [0.19.0] - 2021-11-06
    86  
    87  ### Changed
    88  
    89  - `NewTask` takes `Option` as variadic argument
    90  - Bumped minimum supported go version to 1.14 (i.e. go1.14 or higher is required).
    91  
    92  ### Added
    93  
    94  - `Retention` option is added to allow user to specify task retention duration after completion.
    95  - `TaskID` option is added to allow user to specify task ID.
    96  - `ErrTaskIDConflict` sentinel error value is added.
    97  - `ResultWriter` type is added and provided through `Task.ResultWriter` method.
    98  - `TaskInfo` has new fields `CompletedAt`, `Result` and `Retention`.
    99  
   100  ### Removed
   101  
   102  - `Client.SetDefaultOptions` is removed. Use `NewTask` instead to pass default options for tasks.
   103  
   104  ## [0.18.6] - 2021-10-03
   105  
   106  ### Changed
   107  
   108  - Updated `github.com/go-redis/redis` package to v8
   109  
   110  ## [0.18.5] - 2021-09-01
   111  
   112  ### Added
   113  
   114  - `IsFailure` config option is added to determine whether error returned from Handler counts as a failure.
   115  
   116  ## [0.18.4] - 2021-08-17
   117  
   118  ### Fixed
   119  
   120  - Scheduler methods are now thread-safe. It's now safe to call `Register` and `Unregister` concurrently.
   121  
   122  ## [0.18.3] - 2021-08-09
   123  
   124  ### Changed
   125  
   126  - `Client.Enqueue` no longer enqueues tasks with empty typename; Error message is returned.
   127  
   128  ## [0.18.2] - 2021-07-15
   129  
   130  ### Changed
   131  
   132  - Changed `Queue` function to not to convert the provided queue name to lowercase. Queue names are now case-sensitive.
   133  - `QueueInfo.MemoryUsage` is now an approximate usage value.
   134  
   135  ### Fixed
   136  
   137  - Fixed latency issue around memory usage (see https://github.com/hibiken/asynq/issues/309).
   138  
   139  ## [0.18.1] - 2021-07-04
   140  
   141  ### Changed
   142  
   143  - Changed to execute task recovering logic when server starts up; Previously it needed to wait for a minute for task recovering logic to exeucte.
   144  
   145  ### Fixed
   146  
   147  - Fixed task recovering logic to execute every minute
   148  
   149  ## [0.18.0] - 2021-06-29
   150  
   151  ### Changed
   152  
   153  - NewTask function now takes array of bytes as payload.
   154  - Task `Type` and `Payload` should be accessed by a method call.
   155  - `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`.
   156  - `Scheduler` API has changed. Renamed `Stop` to `Shutdown`.
   157  - Requires redis v4.0+ for multiple field/value pair support
   158  - `Client.Enqueue` now returns `TaskInfo`
   159  - `Inspector.RunTaskByKey` is replaced with `Inspector.RunTask`
   160  - `Inspector.DeleteTaskByKey` is replaced with `Inspector.DeleteTask`
   161  - `Inspector.ArchiveTaskByKey` is replaced with `Inspector.ArchiveTask`
   162  - `inspeq` package is removed. All types and functions from the package is moved to `asynq` package.
   163  - `WorkerInfo` field names have changed.
   164  - `Inspector.CancelActiveTask` is renamed to `Inspector.CancelProcessing`
   165  
   166  ## [0.17.2] - 2021-06-06
   167  
   168  ### Fixed
   169  
   170  - Free unique lock when task is deleted (https://github.com/hibiken/asynq/issues/275).
   171  
   172  ## [0.17.1] - 2021-04-04
   173  
   174  ### Fixed
   175  
   176  - Fix bug in internal `RDB.memoryUsage` method.
   177  
   178  ## [0.17.0] - 2021-03-24
   179  
   180  ### Added
   181  
   182  - `DialTimeout`, `ReadTimeout`, and `WriteTimeout` options are added to `RedisConnOpt`.
   183  
   184  ## [0.16.1] - 2021-03-20
   185  
   186  ### Fixed
   187  
   188  - Replace `KEYS` command with `SCAN` as recommended by [redis doc](https://redis.io/commands/KEYS).
   189  
   190  ## [0.16.0] - 2021-03-10
   191  
   192  ### Added
   193  
   194  - `Unregister` method is added to `Scheduler` to remove a registered entry.
   195  
   196  ## [0.15.0] - 2021-01-31
   197  
   198  **IMPORTATNT**: All `Inspector` related code are moved to subpackage "github.com/hibiken/asynq/inspeq"
   199  
   200  ### Changed
   201  
   202  - `Inspector` related code are moved to subpackage "github.com/hibken/asynq/inspeq".
   203  - `RedisConnOpt` interface has changed slightly. If you have been passing `RedisClientOpt`, `RedisFailoverClientOpt`, or `RedisClusterClientOpt` as a pointer,
   204    update your code to pass as a value.
   205  - `ErrorMsg` field in `RetryTask` and `ArchivedTask` was renamed to `LastError`.
   206  
   207  ### Added
   208  
   209  - `MaxRetry`, `Retried`, `LastError` fields were added to all task types returned from `Inspector`.
   210  - `MemoryUsage` field was added to `QueueStats`.
   211  - `DeleteAllPendingTasks`, `ArchiveAllPendingTasks` were added to `Inspector`
   212  - `DeleteTaskByKey` and `ArchiveTaskByKey` now supports deleting/archiving `PendingTask`.
   213  - asynq CLI now supports deleting/archiving pending tasks.
   214  
   215  ## [0.14.1] - 2021-01-19
   216  
   217  ### Fixed
   218  
   219  - `go.mod` file for CLI
   220  
   221  ## [0.14.0] - 2021-01-14
   222  
   223  **IMPORTATNT**: Please run `asynq migrate` command to migrate from the previous versions.
   224  
   225  ### Changed
   226  
   227  - Renamed `DeadTask` to `ArchivedTask`.
   228  - Renamed the operation `Kill` to `Archive` in `Inpsector`.
   229  - Print stack trace when Handler panics.
   230  - Include a file name and a line number in the error message when recovering from a panic.
   231  
   232  ### Added
   233  
   234  - `DefaultRetryDelayFunc` is now a public API, which can be used in the custom `RetryDelayFunc`.
   235  - `SkipRetry` error is added to be used as a return value from `Handler`.
   236  - `Servers` method is added to `Inspector`
   237  - `CancelActiveTask` method is added to `Inspector`.
   238  - `ListSchedulerEnqueueEvents` method is added to `Inspector`.
   239  - `SchedulerEntries` method is added to `Inspector`.
   240  - `DeleteQueue` method is added to `Inspector`.
   241  
   242  ## [0.13.1] - 2020-11-22
   243  
   244  ### Fixed
   245  
   246  - Fixed processor to wait for specified time duration before forcefully shutdown workers.
   247  
   248  ## [0.13.0] - 2020-10-13
   249  
   250  ### Added
   251  
   252  - `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.
   253  
   254  ### Changed
   255  
   256  - interface `Option` has changed. See the godoc for the new interface.
   257    This change would have no impact as long as you are using exported functions (e.g. `MaxRetry`, `Queue`, etc)
   258    to create `Option`s.
   259  
   260  ### Added
   261  
   262  - `Payload.String() string` method is added
   263  - `Payload.MarshalJSON() ([]byte, error)` method is added
   264  
   265  ## [0.12.0] - 2020-09-12
   266  
   267  **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.
   268  
   269  ## The semantics of queue have changed
   270  
   271  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.
   272  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.
   273  Possible task states are:
   274  
   275  - `Pending`: task is ready to be processed (previously called "Enqueued")
   276  - `Active`: tasks is currently being processed (previously called "InProgress")
   277  - `Scheduled`: task is scheduled to be processed in the future
   278  - `Retry`: task failed to be processed and will be retried again in the future
   279  - `Dead`: task has exhausted all of its retries and stored for manual inspection purpose
   280  
   281  **These semantics change is reflected in the new `Inspector` API and CLI commands.**
   282  
   283  ---
   284  
   285  ### Changed
   286  
   287  #### `Client`
   288  
   289  Use `ProcessIn` or `ProcessAt` option to schedule a task instead of `EnqueueIn` or `EnqueueAt`.
   290  
   291  | Previously                  | v0.12.0                                    |
   292  | --------------------------- | ------------------------------------------ |
   293  | `client.EnqueueAt(t, task)` | `client.Enqueue(task, asynq.ProcessAt(t))` |
   294  | `client.EnqueueIn(d, task)` | `client.Enqueue(task, asynq.ProcessIn(d))` |
   295  
   296  #### `Inspector`
   297  
   298  All Inspector methods are scoped to a queue, and the methods take `qname (string)` as the first argument.
   299  `EnqueuedTask` is renamed to `PendingTask` and its corresponding methods.
   300  `InProgressTask` is renamed to `ActiveTask` and its corresponding methods.
   301  Command "Enqueue" is replaced by the verb "Run" (e.g. `EnqueueAllScheduledTasks` --> `RunAllScheduledTasks`)
   302  
   303  #### `CLI`
   304  
   305  CLI commands are restructured to use subcommands. Commands are organized into a few management commands:
   306  To view details on any command, use `asynq help <command> <subcommand>`.
   307  
   308  - `asynq stats`
   309  - `asynq queue [ls inspect history rm pause unpause]`
   310  - `asynq task [ls cancel delete kill run delete-all kill-all run-all]`
   311  - `asynq server [ls]`
   312  
   313  ### Added
   314  
   315  #### `RedisConnOpt`
   316  
   317  - `RedisClusterClientOpt` is added to connect to Redis Cluster.
   318  - `Username` field is added to all `RedisConnOpt` types in order to authenticate connection when Redis ACLs are used.
   319  
   320  #### `Client`
   321  
   322  - `ProcessIn(d time.Duration) Option` and `ProcessAt(t time.Time) Option` are added to replace `EnqueueIn` and `EnqueueAt` functionality.
   323  
   324  #### `Inspector`
   325  
   326  - `Queues() ([]string, error)` method is added to get all queue names.
   327  - `ClusterKeySlot(qname string) (int64, error)` method is added to get queue's hash slot in Redis cluster.
   328  - `ClusterNodes(qname string) ([]ClusterNode, error)` method is added to get a list of Redis cluster nodes for the given queue.
   329  - `Close() error` method is added to close connection with redis.
   330  
   331  ### `Handler`
   332  
   333  - `GetQueueName(ctx context.Context) (string, bool)` helper is added to extract queue name from a context.
   334  
   335  ## [0.11.0] - 2020-07-28
   336  
   337  ### Added
   338  
   339  - `Inspector` type was added to monitor and mutate state of queues and tasks.
   340  - `HealthCheckFunc` and `HealthCheckInterval` fields were added to `Config` to allow user to specify a callback
   341    function to check for broker connection.
   342  
   343  ## [0.10.0] - 2020-07-06
   344  
   345  ### Changed
   346  
   347  - All tasks now requires timeout or deadline. By default, timeout is set to 30 mins.
   348  - Tasks that exceed its deadline are automatically retried.
   349  - Encoding schema for task message has changed. Please install the latest CLI and run `migrate` command if
   350    you have tasks enqueued with the previous version of asynq.
   351  - API of `(*Client).Enqueue`, `(*Client).EnqueueIn`, and `(*Client).EnqueueAt` has changed to return a `*Result`.
   352  - API of `ErrorHandler` has changed. It now takes context as the first argument and removed `retried`, `maxRetry` from the argument list.
   353    Use `GetRetryCount` and/or `GetMaxRetry` to get the count values.
   354  
   355  ## [0.9.4] - 2020-06-13
   356  
   357  ### Fixed
   358  
   359  - Fixes issue of same tasks processed by more than one worker (https://github.com/hibiken/asynq/issues/90).
   360  
   361  ## [0.9.3] - 2020-06-12
   362  
   363  ### Fixed
   364  
   365  - Fixes the JSON number overflow issue (https://github.com/hibiken/asynq/issues/166).
   366  
   367  ## [0.9.2] - 2020-06-08
   368  
   369  ### Added
   370  
   371  - The `pause` and `unpause` commands were added to the CLI. See README for the CLI for details.
   372  
   373  ## [0.9.1] - 2020-05-29
   374  
   375  ### Added
   376  
   377  - `GetTaskID`, `GetRetryCount`, and `GetMaxRetry` functions were added to extract task metadata from context.
   378  
   379  ## [0.9.0] - 2020-05-16
   380  
   381  ### Changed
   382  
   383  - `Logger` interface has changed. Please see the godoc for the new interface.
   384  
   385  ### Added
   386  
   387  - `LogLevel` type is added. Server's log level can be specified through `LogLevel` field in `Config`.
   388  
   389  ## [0.8.3] - 2020-05-08
   390  
   391  ### Added
   392  
   393  - `Close` method is added to `Client`.
   394  
   395  ## [0.8.2] - 2020-05-03
   396  
   397  ### Fixed
   398  
   399  - [Fixed cancelfunc leak](https://github.com/hibiken/asynq/pull/145)
   400  
   401  ## [0.8.1] - 2020-04-27
   402  
   403  ### Added
   404  
   405  - `ParseRedisURI` helper function is added to create a `RedisConnOpt` from a URI string.
   406  - `SetDefaultOptions` method is added to `Client`.
   407  
   408  ## [0.8.0] - 2020-04-19
   409  
   410  ### Changed
   411  
   412  - `Background` type is renamed to `Server`.
   413  - To upgrade from the previous version, Update `NewBackground` to `NewServer` and pass `Config` by value.
   414  - CLI is renamed to `asynq`.
   415  - To upgrade the CLI to the latest version run `go get -u github.com/hibiken/tools/asynq`
   416  - The `ps` command in CLI is renamed to `servers`
   417  - `Concurrency` defaults to the number of CPUs when unset or set to a negative value.
   418  
   419  ### Added
   420  
   421  - `ShutdownTimeout` field is added to `Config` to speicfy timeout duration used during graceful shutdown.
   422  - New `Server` type exposes `Start`, `Stop`, and `Quiet` as well as `Run`.
   423  
   424  ## [0.7.1] - 2020-04-05
   425  
   426  ### Fixed
   427  
   428  - Fixed signal handling for windows.
   429  
   430  ## [0.7.0] - 2020-03-22
   431  
   432  ### Changed
   433  
   434  - Support Go v1.13+, dropped support for go v1.12
   435  
   436  ### Added
   437  
   438  - `Unique` option was added to allow client to enqueue a task only if it's unique within a certain time period.
   439  
   440  ## [0.6.2] - 2020-03-15
   441  
   442  ### Added
   443  
   444  - `Use` method was added to `ServeMux` to apply middlewares to all handlers.
   445  
   446  ## [0.6.1] - 2020-03-12
   447  
   448  ### Added
   449  
   450  - `Client` can optionally schedule task with `asynq.Deadline(time)` to specify deadline for task's context. Default is no deadline.
   451  - `Logger` option was added to config, which allows user to specify the logger used by the background instance.
   452  
   453  ## [0.6.0] - 2020-03-01
   454  
   455  ### Added
   456  
   457  - Added `ServeMux` type to make it easy for users to implement Handler interface.
   458  - `ErrorHandler` type was added. Allow users to specify error handling function (e.g. Report error to error reporting service such as Honeybadger, Bugsnag, etc)
   459  
   460  ## [0.5.0] - 2020-02-23
   461  
   462  ### Changed
   463  
   464  - `Client` API has changed. Use `Enqueue`, `EnqueueAt` and `EnqueueIn` to enqueue and schedule tasks.
   465  
   466  ### Added
   467  
   468  - `asynqmon workers` was added to list all running workers information
   469  
   470  ## [0.4.0] - 2020-02-13
   471  
   472  ### Changed
   473  
   474  - `Handler` interface has changed. `ProcessTask` method takes two arguments `context.Context` and `*asynq.Task`
   475  - `Queues` field in `Config` has change from `map[string]uint` to `map[string]int`
   476  
   477  ### Added
   478  
   479  - `Client` can optionally schedule task with `asynq.Timeout(duration)` to specify timeout duration for task. Default is no timeout.
   480  - `asynqmon cancel [task id]` will send a cancelation signal to the goroutine processing the speicified task.
   481  
   482  ## [0.3.0] - 2020-02-04
   483  
   484  ### Added
   485  
   486  - `asynqmon ps` was added to list all background worker processes
   487  
   488  ## [0.2.2] - 2020-01-26
   489  
   490  ### Fixed
   491  
   492  - Fixed restoring unfinished tasks back to correct queues.
   493  
   494  ### Changed
   495  
   496  - `asynqmon ls` command is now paginated (default 30 tasks from first page)
   497  - `asynqmon ls enqueued:[queue name]` requires queue name to be specified
   498  
   499  ## [0.2.1] - 2020-01-22
   500  
   501  ### Fixed
   502  
   503  - More structured log messages
   504  - Prevent spamming logs with a bunch of errors when Redis connection is lost
   505  - Fixed and updated README doc
   506  
   507  ## [0.2.0] - 2020-01-19
   508  
   509  ### Added
   510  
   511  - NewTask constructor
   512  - `Queues` option in `Config` to specify mutiple queues with priority level
   513  - `Client` can schedule a task with `asynq.Queue(name)` to specify which queue to use
   514  - `StrictPriority` option in `Config` to specify whether the priority should be followed strictly
   515  - `RedisConnOpt` to abstract away redis client implementation
   516  - [CLI] `asynqmon rmq` command to remove queue
   517  
   518  ### Changed
   519  
   520  - `Client` and `Background` constructors take `RedisConnOpt` as their first argument.
   521  - `asynqmon stats` now shows the total of all enqueued tasks under "Enqueued"
   522  - `asynqmon stats` now shows each queue's task count
   523  - `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)
   524  - Task type is now immutable (i.e., Payload is read-only)
   525  
   526  ## [0.1.0] - 2020-01-04
   527  
   528  ### Added
   529  
   530  - Initial version of asynq package
   531  - Initial version of asynqmon CLI