Added
- Exposed
TestConfig
struct onConfig
under theTest
field for configuration that is specific to test environments. For now, the only field on this type isTime
, which can be used to set a syntheticTimeGenerator
for tests. A stubbable time generator was added asrivertest.TimeStub
to allow time to be easily stubbed in tests. PR #754. - New
rivertest.Worker
type to make it significantly easier to test River workers. Either real or synthetic jobs can be worked using this interface, generally without requiring any database interactions. TheWorker
type provides a realistic execution environment with access to the full range of River features, includingriver.ClientFromContext
, middleware (both global and per-worker), and timeouts. PR #753.
Changed
- Errors returned from retryable jobs are now logged with warning logs instead of error logs. Error logs are still used for jobs that error after reaching
max_attempts
. PR #743. - Remove range variable capture in
for
loops and use simplifiedrange
syntax. Each of these requires Go 1.22 or later, which was already our minimum required version since Go 1.23 was released. PR #755.
Fixed
riverdatabasesql
driver: properly handlenil
values inbytea[]
inputs. This fixes the driver's handling of empty unique keys on insert for non-unique jobs with the newer unique jobs implementation. PR #739.JobCompleteTx
now returnsrivertype.ErrNotFound
if the job doesn't exist instead of panicking. PR #753.