Skip to content

Commit

Permalink
Return immediately if client is ready
Browse files Browse the repository at this point in the history
No need to wait for redis to emit "ready" if the client connection is already ready. This prevents the function to forever hang awaiting for a ready command from an already ready client.
  • Loading branch information
Azhrak authored Feb 19, 2024
1 parent 6906cab commit 4e43aa6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/strapi-provider-rest-cache-redis/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ function waitForRedis(client) {
);
};

if (client.status === "ready") {
return onReady();
}

client.once("ready", onReady);
client.once("error", onError);
});
Expand Down

0 comments on commit 4e43aa6

Please sign in to comment.