Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
Maybe it's actually fixed this time
Browse files Browse the repository at this point in the history
  • Loading branch information
Asheviere committed Aug 10, 2018
1 parent 298f097 commit 1458092
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion redis.js
Expand Up @@ -34,7 +34,7 @@ module.exports = {
let client = redis.createClient({database: i, usePromise: true});
client.on('error', async error => {
errorMsg(`Received ${error} from redis, restarting.`);
await this.restart();
if (!this.restarting) await this.restart();
client.clientConnect();
});
client.on('close', () => {
Expand All @@ -45,8 +45,10 @@ module.exports = {
},

restart() {
this.restarting = true;
return new Promise(resolve => {
exec(`rm /var/run/redis_6379.pid && /etc/init.d/redis_6379 start`, async () => {
this.restarting = false;
resolve();
});
});
Expand Down

0 comments on commit 1458092

Please sign in to comment.