From 66ebf6103e99666fcded6b2a65253ae5e8576cae Mon Sep 17 00:00:00 2001 From: Brandur Date: Sat, 2 Aug 2025 14:31:42 -0700 Subject: [PATCH] Remove `WorkerDefaults.Hooks` Remove `WorkerDefaults.Hooks`. I believe this was a vestige left in after a number of refactoring passes as it's not used anywhere (if I recall correctly, workers may have started with hooks, but they were moved to `JobArgs` because hooks the job args part of an args/worker combination are more available in more places). This is technically a breaking change, but this was never used at any point and it shouldn't realistically break anyone. --- CHANGELOG.md | 1 + worker.go | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0960ef7b..2710a133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - A logger passed in via `river.Config` now overrides the default test-based logger when using `rivertest.NewWorker`. [PR #980](https://github.com/riverqueue/river/pull/980). - Cleaner retention periods (`CancelledJobRetentionPeriod`, `CompletedJobRetentionPeriod`, `DiscardedJobRetentionPeriod`) can be configured to -1 to disable them so that the corresponding type of job is retained indefinitely. [PR #990](https://github.com/riverqueue/river/pull/990). - Jobs inserted from periodic jobs with IDs now have metadata `river:periodic_job_id` set so they can be traced back to the periodic job that inserted them. [PR #992](https://github.com/riverqueue/river/pull/992). +- The unused function `WorkerDefaults.Hooks` has been removed. This is technically a breaking change, but this function was a vestigal refactoring artifact that was never used by anything, so in practice it shouldn't be breaking. [PR #997](https://github.com/riverqueue/river/pull/997). ### Fixed diff --git a/worker.go b/worker.go index 1a5aedf6..ff33a832 100644 --- a/worker.go +++ b/worker.go @@ -74,8 +74,6 @@ type Worker[T JobArgs] interface { // struct to make it fulfill the Worker interface with default values. type WorkerDefaults[T JobArgs] struct{} -func (w WorkerDefaults[T]) Hooks(*rivertype.JobRow) []rivertype.Hook { return nil } - func (w WorkerDefaults[T]) Middleware(*rivertype.JobRow) []rivertype.WorkerMiddleware { return nil } // NextRetry returns an empty time.Time{} to avoid setting any job or