- Use DB facade instead of model fr performance.
- Wrap update query in a database transaction to help against deadlocks with external tracker.
- Better documentation.
- $userIds = Redis::command('LPOP', [$key, $userIdCount]); returned an array of strings so not sure how this worked. Wrapped in an array_map('intval', ).
If there are no users in the list, null is returned, so we have to check against null.
Since we cache users for 30 seconds, checking their last action time is pointless.