Error while reading line from the server. [tcp://127.0.0.1:6379]
Error while reading line from the server. [tcp://127.0.0.1:6379] found at /horizon/api/jobs/recent
Predis\Connection\ConnectionException: Error while reading line from the server.
Now I can only imagine I got this because I'm running a huge task in the queue which isn't the best but I can't see any way around it. So my Lapse started going crazy one afternoon and I could not figure out what this was. I could not find much on the web so I thought I would document what my process was to remove this. Probably not best practice but it worked and if anyone has any better ways please feel free to comment below.
Go to your server and type the following to remove everything from redis:
redis-cli
127.0.0.1:6379>FLUSHDB
OK
127.0.0.1:6379> exit
Now go to [Your Site]/horizon and you will see its been cleared out and this thank fully stops all your alerts and errors. Now Redis must have been full due to all the recent jobs/failed taking up all the storage.
Let's create something that can do this every week to avoid this. So make a command:php artisan make:command FlushRedisDB --command=flush:redis
Go to app/Console/Kernel.php and enter the following in the commands section:protected $commands = [
Commands\FlushRedisDB::class
];
Now in the schedule section add:$schedule->command('flush:redis')->weekly();
Go back to the new command you created and in the handle function add the following:public function handle()
{
Redis::command('flushdb');
}
Categories: Posts