Skip to content

Conversation

@iazaran
Copy link

@iazaran iazaran commented Dec 30, 2025

This PR fixes #58214.

Problem

When using phpredis with serialization or compression enabled, delayed queue jobs don't work correctly. The laterRaw() method uses zadd() directly, which triggers phpredis serialization on the payload. However, when the Lua script migrateExpiredJobs migrates these jobs, it reads the raw bytes which are now serialized/compressed and cannot be properly decoded.

In contrast, pushRaw() uses a Lua script via eval() which bypasses phpredis serialization, storing the payload RAW in Redis.

Solution

Changed laterRaw() to use a Lua script (like pushRaw does) instead of calling zadd directly. This ensures the payload bypasses phpredis serialization and is stored consistently with other queue operations.

Changes

  • Added new later() Lua script in LuaScripts.php for pushing delayed jobs
  • Modified laterRaw() in RedisQueue.php to use the new Lua script
  • Added integration test that reproduces the issue with phpredis serialization enabled
  • Updated unit tests to expect eval instead of zadd

Benefits

  • Delayed queue jobs now work correctly when phpredis has serialization/compression enabled
  • Consistent behavior between immediate (push) and delayed (later) job dispatch
  • No breaking changes to the public API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using the Redis driver for Queue with the native phpredis, the delayed job does not work.

1 participant