๋ค์ ์ฝ๋๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
const redis = require('redis');
const client = redis.createClient({
url: 'redis://localhost:6379',
retry_strategy: options => new Error('Fail')
});
setInterval(() => client.incr('some-key', console.log), 5000);
๋ก์ปฌ redis์ ๋ํด ์คํ( docker run --rm -p 6379:6379 redis
)
์ฒซ ๋ฒ์งธ ์ถ๋ ฅ์ ๋ณธ ํ ์ฐ๊ฒฐ ํด์ ๋ฅผ ์๋ฎฌ๋ ์ด์
ํ๊ธฐ ์ํด redis๋ฅผ ์ข
๋ฃํฉ๋๋ค. ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ ๊ฒ์ ๋ณด์์ ๋ redis๋ฅผ ๋ค์ ์์ํฉ๋๋ค. ๋ค์ ์ฐ๊ฒฐ์ด ๋์ง ์์ต๋๋ค. ์คํ๋ผ์ธ ์ฒ๋ฆฌ๊ธฐ์ ์ค๋ฅ๋ฅผ ํ๋ฌ์ํ ํ ํด๋ผ์ด์ธํธ๊ฐ ๋ค์ ๋ช
๋ น์์ ๋ค์ ์ฐ๊ฒฐ์ ์๋ํ ๊ฒ์ผ๋ก ์์ํฉ๋๋ค. ๋์ ๋ซํ ์ํ๋ก ์ ์ง๋ฉ๋๋ค. ๋ํ ๊ทธ๊ฒ์ ํจ๊ป ๋ฐํ ์์ด์ AbortError
๋์ new Error('Fail')
.
retry_strategy์ ๋ํ ๋ฌธ์๋ฅผ ํตํด node_redis๋ ํจ์๊ฐ ์ซ์๋ฅผ ๋ฐํํ๋ ๊ฒฝ์ฐ์๋ง ์ฌ์ฐ๊ฒฐ์ ์๋ํ๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค.
์ด ํจ์์์ ์ซ์๋ฅผ ๋ฐํํ๋ ๊ฒฝ์ฐ ์ฌ์๋๋ ์ ํํ ํด๋น ์๊ฐ(๋ฐ๋ฆฌ์ด) ์ดํ์ ๋ฐ์ํฉ๋๋ค.
๊ทํ์ ๊ฒฝ์ฐ ์ฌ์ฐ๊ฒฐ ์๋ ์๊ตฌ ์ฌํญ์ ์ถฉ์กฑํ์ง ์๋ ๋น ๋ฒํธ๋ฅผ ๋ฐํํฉ๋๋ค.
์ซ์๊ฐ ์๋ ๊ฐ์ ๋ฐํํ๋ฉด ๋ ์ด์ ์ฌ์๋ํ์ง ์๊ณ ๋ชจ๋ ์คํ๋ผ์ธ ๋ช ๋ น์ด ์ค๋ฅ๋ก ํ๋ฌ์๋ฉ๋๋ค.
๋ด๊ฐ ์ฐพ๊ณ ์๋ ํ๋ฆ์ ์ฐ๊ฒฐ์ด ๋๊ธธ ๋ 1์ด ๊ฐ๊ฒฉ์ผ๋ก 3๋ฒ ์ฐ๊ฒฐ์ ๋ค์ ์๋ํ๋ ๊ฒ์ ๋๋ค. ์ธ ๋ฒ์งธ์๋ ์ฌ์ ํ ์ฐ๊ฒฐ์ด ๋๊ธด ๊ฒฝ์ฐ ์ค๋ฅ์ ํจ๊ป ๋ชจ๋ ๋ฏธํด๊ฒฐ ๋ช ๋ น์ ๋ฐํํด์ผ ํฉ๋๋ค. ๋ค์ ์ฐ๊ฒฐํ๋ ค๋ ์๋๋ฅผ ์ค์งํ๊ณ ์ถ์ง ์์ต๋๋ค.
README.md์ ์ ๊ณต๋ ์์ ์ ์์ ๋ ๋ฒ์ ์ ์ฌ์ฉํ๋ฉด ์ํ๋ ๊ฒ์ ์ป์ ์ ์์ ๊ฒ์
๋๋ค. ๊ทธ๋ฌ๋ ์ต๋ ์๋ ํ์์ธ 3์ด ์์ง๋๋ฉด ํด๋ผ์ด์ธํธ๋ ๋ค์ ๋ช
๋ น์์ ์๋์ผ๋ก ์ฌ์ฐ๊ฒฐ์ ์๋ํ์ง ์์ต๋๋ค. createClient()
๋ฅผ ์๋์ผ๋ก ๋ค์ ํธ์ถํด์ผ ํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
const client = redis.createClient({
url: 'redis://localhost:6379',
retry_strategy: (options) => {
if (options.times_connected >= 3) {
// End reconnecting after a specific number of tries and flush all commands with a individual error
return new Error('Retry attempts exhausted');
}
// reconnect after
return 1000;
}
});
์, ์ฌ๊ธฐ์๋ ์ฐจ์ด๊ฐ ์๊ธฐ ๋๋ฌธ์ ์๋๋ฅผ ์๋ตํ์ต๋๋ค.
๋ฐ๋ผ์ ๊ธฐ๋ณธ์ ์ผ๋ก ๋ค์์ ์๋ฏธํฉ๋๋ค.
let client = createClient();
function createClient () {
return redis.createClient({
url: 'redis://localhost:6379',
retry_strategy: (options) => {
client = createClient();
return new Error('Retry attempts exhausted');
}
});
}
๋ด ์ฝ๋์์ ๋ ์ด์ ๋ด redis ํด๋ผ์ด์ธํธ๋ฅผ ์ ๋ฌํ ์ ์๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๊น?
redis ํด๋ผ์ด์ธํธ์ ์ฑ๊ธํค ์ธ์คํด์ค๋ฅผ ๊ด๋ฆฌํ๊ธฐ ์ํด ๊ฐ๋ฒผ์ด ๋ํผ๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค.
// redisClient.js
let redis = require("redis");
let client = null;
const options = {
url: 'redis://localhost:6379',
retry_strategy: (options) => {
client = null;
return new Error("Redis client connection dropped.");
}
};
module.exports = {
getClient: () => {
if (client == null) {
client = redis.createClient(options);
}
return client;
}
};
์ฌ์ฉ:
// usage
let client = require("redisClient.js");
client.getClient().get("some key");
client.getClient().set("some key", "some value");
๋๋ ์ด๊ฒ์ด ์ฌ์๋ ์ ๋ต์์ createClient()
๋ฅผ ํธ์ถํ๋ ๊ฒ๊ณผ ๋งค์ฐ ์ ์ฌํ๋ค๊ณ ์๊ฐํ์ง๋ง ๋๋ ๊ทธ ๋ฐฉ๋ฒ์ ์ด๋ ฌํ ํฌ์ ์๋๋๋ค.
getClient()
ํญ์ ํธ์ถํด์ผ ํ๋ ํ์์ฑ์ ์ค์ด๋ ค๋ฉด get()
, set()
๋ฑ๊ณผ ๊ฐ์ ๋ชจ๋ redis ํธ์ถ์ ๋ํํ๋ ํฐ ๋ํผ๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค. ๊ฐ ๋ฉ์๋์์ getClient()
๋ฅผ ํธ์ถํฉ๋๋ค. ๊ทธ๋ฌ๋ ์ด getClient()
๋ฐฉ์์ ์ด์ฑ์ ์ผ๋ก ์ฐ๊ฒฐ์ ๊ด๋ฆฌํ๊ธฐ ๋ณด๋ค๋ ๋๋ฆฌ๊ฒ ์ฐ๊ฒฐ์ ๊ด๋ฆฌํ๋ ๊ฝค ์ผ๋ฐ์ ์ธ ๋ฐฉ๋ฒ์
๋๋ค.
ํ์คํ์ง๋ง ์ด์จ๋ ์ถ๊ฐ ์ฌ์๋ ๋ํผ๋ก ๋ฉํํด์ผ ํ๋ ๊ฒฝ์ฐ ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ฌ์๋ ์ ๋ต์ ์ ํ ์ ๊ณตํ์ง ์๋ ์ด์ ๋ ๋ฌด์์ ๋๊น?
์ ๋ ์ ์๊ฐ ์๋๋ฏ๋ก retry_strategy์ ํน์ ๊ตฌํ ์ด๋ฉด์ ์๋ ๋๊ธฐ๋ฅผ ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. node_redis๋ฅผ ์ง์ ์ฌ์ฉํ๋ฉด์ retry_strategy์ ํ์ฌ ๊ธฐ๋ฅ์ด ์ ์ฉํ๋ค๋ ๊ฒ์ ์์์ง๋ง ์ด๋ค ์ผ์ด ์์ด๋ ์๋์ผ๋ก ์ฌ์๋ํ๋ ๊ธฐ๋ฅ์ด ๋ถ์กฑํ๋ค๋ ๋ฐ ๋์ํฉ๋๋ค. ๋ด ์ฌ์ฉ์์ ๋๋ ํญ์ ์ฐ๊ฒฐ ์๋๊ฐ ์ด๋ฃจ์ด์ง๊ธฐ๋ฅผ ์ํ๊ธฐ ๋๋ฌธ์ retry_strategy์์ ์ผ๊ด๋๊ฒ ์ซ์๋ฅผ ๋ฐํํ์ผ๋ฉฐ ์ค๋ฅ๋ฅผ ๋ฐํํ์ง ์์์ต๋๋ค. ๊ทธ๋ฌ๋ retry_strategy ๋ด์์ ์ค๋ฅ๋ฅผ ๊ธฐ๋กํฉ๋๋ค.
์ด๋ฐ ๊ฑด ์ด๋? https://github.com/viglucci/node_redis/tree/feature-reconnect-after-flush#retry_strategy -example
var client = redis.createClient({
retry_strategy: function (options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
// End reconnecting on a specific error and flush all commands with a individual error
return new Error('The server refused the connection');
}
if (options.total_retry_time > 1000 * 60 * 60) {
// End reconnecting after a specific timeout and flush all commands with a individual error
return new Error('Retry time exhausted');
}
// attempt reconnect after retry_delay, and flush any pending commands
return {
retry_delay: Math.min(options.attempt * 100, 3000),
error: new Error('Your custom error.');
}
}
});
๊ฐ๋ ์ ์ผ๋ก ๋ง์ ์๋ฏธ๊ฐ ์์ต๋๋ค. ์ด๊ฒ์ ๊ตฌํํ๋ ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์ด๊ฒ์ ๋ ๊ฐ์ง ์ ๋ต์ผ๋ก ๋๋๋ ๊ฒ์ ๋๋ค.
var client = redis.createClient({
// this strategy handles the pending redis commands when the connection goes down
flush_strategy (options) {
if (options.attempt >= 3) {
// flush all pending commands with this error
return new Error('Redis unavailable')
}
// let the connection come up again on its own
return null;
},
// this strategy handles the reconnect of a failing redis
retry_strategy (options) {
if (options.total_retry_time > 1000 * 60 * 60) {
// The connection is never going to get up again
// kill the client with the error event
return new Error('Retry time exhausted');
}
// attempt reconnect after this delay
return Math.min(options.attempt * 100, 3000)
}
});
๋๋ flush_strategy
๋ผ๋ ์ด๋ฆ์ ๋ณ๋ก ์ข์ํ์ง ์์ง๋ง ๋ ๋์ ๊ฒ์ ์๊ฐํด๋ผ ์ ์์ต๋๋ค.
์ค ํฅ๋ฏธ๋กญ๊ตฐ. ์ฌ๊ธฐ์ ์ ์ํ๋ ๊ฒ์ ํ์ฌ retry_strategy
์ connection_strategy
๋ฐ๊พธ๊ณ ๊ธฐ์กด retry_strategy
๋ฅผ flush_strategy
๋ผ๊ณ ๋ถ๋ฅด๋ ๊ฒ์ผ๋ก ์ฌ์ฉํ๋ ๊ฒ๊ณผ ๊ฐ์ต๋๋ค.
var client = redis.createClient({
// this strategy handles reconnection
connection_strategy (options) {
if (options.total_retry_time > 1000 * 60 * 60) {
// The connection is never going to get up again
// kill the client with the error event
return new Error('Retry time exhausted');
}
// attempt reconnect after this delay
return Math.min(options.attempt * 100, 3000)
},
// this strategy handles the pending redis commands when the connection goes down
retry_strategy (options) {
if (options.attempt >= 3) {
// flush all pending commands with this error
return new Error('Redis unavailable');
}
// let the client attempt the commands once a connection is available
return null;
},
});
๊ตฌํ: https://github.com/viglucci/node_redis/tree/feature-connection-strategy#retry_strategy -example
@Janpot ์ด๊ฒ์ด ํ์ํ ์ฌ์ฉ ์ฌ๋ก๋ฅผ ์์ธํ retry_strategy
๋ ์ด๋ฏธ ๊ฐ๋ ฅํ ์ต์
์
๋๋ค.
@viglucci ์ฌ๊ธฐ์ ๋ต๋ณํด ํ๋ผ๋ ๋น์ ์
@BridgeAR ์ด๋ค ์ด์ ๋ก redis ์ฐ๊ฒฐ์ด ๋์ด์ง๋ฉด ๋ชจ๋ ๋ช ๋ น์ด ์ค๋จ๋ฉ๋๋ค. redis๊ฐ ์ํํ๋ ์์ ์ ๋ํ ๋์ฒด๊ฐ ์๋ค๊ณ ๊ฐ์ ํ๋ฉด ํด๋น ๋์ฒด๋ ์ค๋จ๋ฉ๋๋ค. ๋๋ ์คํ๋ ค redis๊ฐ ๋ช ๋ฒ์ ์ฌ์๋ ํ์ ์ค๋ฅ๋ฅผ ๋ฐํํ๊ธฐ๋ฅผ ์ํฉ๋๋ค. ๋๋ ์ด๊ฒ์ ์ก์์ ๋์ฒดํ ์ ์์ต๋๋ค. ๊ทธ๋ ๋ค๊ณ ํด์ ํด๋ผ์ด์ธํธ๊ฐ ์ฐ๊ฒฐ ์๋๋ฅผ ์ค์งํ๋ ๊ฒ์ ์ํ์ง ์๋๋ค๋ ์๋ฏธ๋ ์๋๋๋ค. Redis๋ 1๋ถ ์์ ๋ค์ ๋์์ฌ ์ ์์ต๋๋ค.
๋๋ ํ์ฌ ํ๋์ ์์ ์ ๋ณด์ง ๋ชปํฉ๋๋ค. ์ฌ์๋ ํธ๋ค๋ฌ์์ ์ค๋ฅ๋ฅผ ๋ฐํํ๋ฉด ํด๋ผ์ด์ธํธ๊ฐ ์์ํ ์ฃฝ์ต๋๋ค. ๋ชจ๋ ๋ช ๋ น์ ๋ํด ํด๋ผ์ด์ธํธ๋ฅผ ์์ฑํ์ง ์๋ ํ ๋๊ฐ ๊ทธ๋ฐ ์ข ๋ฅ์ ํ๋์ ํ์๋ก ํฉ๋๊น?
์๋๋ฉด ๋ฌผ๋ก ๊ทธ ์ฌ์ฉ ์ฌ๋ก๋ฅผ ๋ณด์ง ๋ชปํ ์๋ ์์ต๋๋ค ๐
@BridgeAR ๊ฐ์ฌํฉ๋๋ค. ๊ตฌ์ฑ ๋งค๊ฐ๋ณ์์ ๋ํ ์ง์ ์ ๊ฑฐ/์ฌ์ฉ ์ค๋จ ๊ฒฝ๊ณ ์ ๊ฑฐ ๋ฑ๊ณผ ๊ฐ์ ๊ฐ๋จํ ์์ ์ด ํฌํจ๋ "V3๋ก ๊ฐ๋ ๊ธธ" ๋ก๋๋งต์ด ์๋ ๊ฒฝ์ฐ ํ ์์ฒญ ์ ์ถ์ ๊ด์ฌ์ด ์์ต๋๋ค. ์๋ง๋ ์ถ๊ฐ redis ๋ช ๋ น์ ๋ํ ์ง์์ ์ถ๊ฐํ๋ ๊ฒ๊ณผ ๊ฐ์ ๋๊ท๋ชจ ์์ ์ ์ฒ๋ฆฌํ ์ ์์ ๊ฒ์ ๋๋ค. ํ์ง๋ง V3 ๊ธฐ๋ฅ ๋ถ๊ธฐ๋ฅผ ์ฌ์ฉํ ์ ์๊ฒ ๋๋ฉด PR์ฉ์ผ๋ก ์ด๋ฆฌ๋ฉด ๊ฐ๋จํ ์ง ์ฒญ์ ์์ ์ ์ํํ ์ ์์ ๊ฒ์ ๋๋ค.
@viglucci ํ๋ ฅ์๋ก ์ด๋ํ์ต๋๋ค. ์กฐ๋ง๊ฐ ๊ณํ์ ์ธ์๋ด์ผ๊ฒ ๋ค
์ด ๋ฌธ์ ์ ๋ํ ํด๊ฒฐ์ฑ ์ +1์ ๋๋ค.
๋๋ Express๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฉฐ, ๋ด retry_strategy
๊ฐ ์ฌ์ ํ ์ ์๋ฅผ ๋ฐํํ์ฌ ๋์ค์ ๋ค์ ์ฐ๊ฒฐ์ ์๋ํ๊ณ ์์ง๋ง ๋ช
๋ น(๋ฐ ์น ์์ฒญ)์ ๋ฌด์ธ๊ฐ๋ฅผ ๋์ง๋ ๋์ ๊ณ์ํด์ ์์ฌ์ ๋ฐฑ์
๋ฉ๋๋ค. ๊ทธ๋ค์ ์ถ๊ณผ ํจ๊ป... ๊ทธ๋ฆฌ๊ณ ํฌ๋ง์ ์ผ๋ก ์ฐ๊ฒฐ์ _๊ฒฐ๊ตญ์ ์ผ๋ก_ ์ ๋ต์ด ํฌ๊ธฐํ๊ฑฐ๋ ๋ฌด์์ด๋ ๋งํ๊ธฐ ์ ์ ์ฌ๊ตฌ์ถ๋ฉ๋๋ค.
์ด๊ฒ์ด ๋ฌ์ฑ๋ ์ ์์ต๋๊น? @Janpot ํ์ฌ ์ด ์ํฉ์ ํด๊ฒฐํ ์ ์๋ ๊ฒ์ ์ฐพ์์ต๋๊น?
enable_offline_queue
๋ฐ/๋๋ retry_unfulfilled_commands
์ต์
์ ์ฌ์ฉํ์ฌ ์ด ์์
์ ์ํํ ์ ์์ต๋๊น?
๋ชจ๋ ๋ถ๋ค์ ๋ ธ๊ณ ์ ๋์์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
์ฌ๊ธฐ์์ ๋น ๋ฅธ ์
๋ฐ์ดํธ.
enable_offline_queue = false
๋ฅผ createClient
์ต์
์ ์ถ๊ฐํ๋๋ฐ ์ํ๋ ๋๋ก ์ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
" retry_strategy
๊ธฐ๋ฅ์ ๊ธฐ๋ฐ์ผ๋ก ๋ด Redis ์๋ฒ์ ๊ณ์ ์ฌ์ฐ๊ฒฐ์ ์๋ํ์ง๋ง ๊ทธ ๋์ ํด๋ผ์ด์ธํธ๋ฅผ ์ฌ์ฉํ๋ ค๋ ์๋์ ๋ํ ์๋ต์ผ๋ก ์ฆ์ ์ค๋ฅ๋ฅผ throwํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ ๋ค์ ์ฐ๊ฒฐํ ์ ์์ผ๋ฉด ๋ค์ ์์
์ ์์ํ์ญ์์ค. ".
์ฐธ๊ณ : get
ํธ์ถ ์ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. AbortError: SET can't be processed. Stream not writeable.
DB์ ์ฑ ์ฌ์ด์ ์ง์ ๋ ์ด์ด๋ก ์ฌ์ฉํ๋ ค๋ฉด ๊ด์ฐฎ์ต๋๋ค. ๋ค์๊ณผ ๊ฐ์ ๊ฒฝ์ฐ์ ๊ฐ๋ฅํ "๊ฐ๋ ฅํ" ์๋ฃจ์ ์ด ์๋์ง ์๊ณ ์ถ์ต๋๋ค.
retry_strategy
๊ธฐ๋ฐ์ผ๋ก ๊ณ์ํด์ ๋ค์ ์ฐ๊ฒฐ์ ์๋ํฉ๋๋ค.์๋ง๋ ์ฌ๊ธฐ์์ ๊ณ ๋ คํด์ผ ํ ์ด๋ ค์ด ์๋๋ฆฌ์ค๊ฐ ๋ง์ด ์์ ๊ฒ์ ๋๋ค...
@์์ง ,
์ธ๊ธํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. ์ฐ๋ฆฌ๋ ์ฐ๋ฆฌ ์์ฉ ํ๋ก๊ทธ๋จ์ ๋ํด ๋์ผํ ๋์์ ์ํ๊ณ ๊ทํ์ ์๋ฃจ์ ์ ํธ์ถ์์๊ฒ ์ฆ์ ์ค๋ฅ๋ฅผ ๋ฐํํ๋ ๋ฐ ํจ๊ณผ๊ฐ ์์์ง๋ง ๋ฌด๊ธฐํ ์ฐ๊ฒฐ์ ๋ค์ ์๋ํ ์ ์์ต๋๋ค.
@newhouse ๊ฐ์ฌํฉ๋๋ค.
IMO ์ด๊ฒ์ ๊ธฐ๋ณธ ๋์์ด๊ฑฐ๋ ์ ์ด๋ retry_strategy
์ฃผ๋ณ์ ๋ฌธ์์์ ๋ช
์์ ์ผ๋ก ํธ์ถ๋์ด์ผ ํฉ๋๋ค. ํ์๊ฐ ํฉ๋ฆฌ์ ์ด๋ผ๊ณ ์๊ฐํ์๋ฉด ์๋ ค์ฃผ์๋ฉด PR์ ์ด์ด ๋ฌธ์๋ฅผ ์ถ๊ฐํ๊ฒ ์ต๋๋ค.
@bwhitty ๋๊ตฌ๋ ์ง ๋ฌธ์ PR์ ํ์ํฉ๋๋ค ๐
enable_offline_queue = false
๋ฅผ ์ฌ์ฉํ๋ ํ ๊ฐ์ง ๋ฌธ์ ๋ createClient
ํธ์ถํ ์งํ์ ์ ์ก๋ ๋ช
๋ น์ด์ง๋ง ์ฐ๊ฒฐ์ด ์ค์ ๋ก ์ด๋ฆฌ๊ธฐ ์ ์๋ ์คํจํ๋ค๋ ๊ฒ์
๋๋ค.
enable_offline_queue = false
๋ฅผ ์ฌ์ฉํ๋ ํ ๊ฐ์ง ๋ฌธ์ ๋createClient
ํธ์ถํ ์งํ์ ์ ์ก๋ ๋ช ๋ น์ด์ง๋ง ์ฐ๊ฒฐ์ด ์ค์ ๋ก ์ด๋ฆฌ๊ธฐ ์ ์๋ ์คํจํ๋ค๋ ๊ฒ์ ๋๋ค.
@jkirkwood ready
์ด๋ฒคํธ(๋๋ ์ด์ ์ ์ฌํ ์ ์ ํ ์ด๋ฒคํธ)๊ฐ ๋ฐฉ์ถ๋ ๋๊น์ง ์ฒซ ๋ฒ์งธ ๋ช
๋ น ์ ์ก ์๋๋ฅผ ์ง์ฐํ๊ณ ์ถ์ ๊ฒ ๊ฐ์ต๋๊น?
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ฌ๊ธฐ์์ ๋น ๋ฅธ ์ ๋ฐ์ดํธ.
enable_offline_queue = false
๋ฅผcreateClient
์ต์ ์ ์ถ๊ฐํ๋๋ฐ ์ํ๋ ๋๋ก ์ํ๋ ๊ฒ ๊ฐ์ต๋๋ค."
retry_strategy
๊ธฐ๋ฅ์ ๊ธฐ๋ฐ์ผ๋ก ๋ด Redis ์๋ฒ์ ๊ณ์ ์ฌ์ฐ๊ฒฐ์ ์๋ํ์ง๋ง ๊ทธ ๋์ ํด๋ผ์ด์ธํธ๋ฅผ ์ฌ์ฉํ๋ ค๋ ์๋์ ๋ํ ์๋ต์ผ๋ก ์ฆ์ ์ค๋ฅ๋ฅผ throwํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ ๋ค์ ์ฐ๊ฒฐํ ์ ์์ผ๋ฉด ๋ค์ ์์ ์ ์์ํ์ญ์์ค. ".์ฐธ๊ณ :
get
ํธ์ถ ์ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.AbortError: SET can't be processed. Stream not writeable.
DB์ ์ฑ ์ฌ์ด์ ์ง์ ๋ ์ด์ด๋ก ์ฌ์ฉํ๋ ค๋ฉด ๊ด์ฐฎ์ต๋๋ค. ๋ค์๊ณผ ๊ฐ์ ๊ฒฝ์ฐ์ ๊ฐ๋ฅํ "๊ฐ๋ ฅํ" ์๋ฃจ์ ์ด ์๋์ง ์๊ณ ์ถ์ต๋๋ค.
retry_strategy
๊ธฐ๋ฐ์ผ๋ก ๊ณ์ํด์ ๋ค์ ์ฐ๊ฒฐ์ ์๋ํฉ๋๋ค.์๋ง๋ ์ฌ๊ธฐ์์ ๊ณ ๋ คํด์ผ ํ ์ด๋ ค์ด ์๋๋ฆฌ์ค๊ฐ ๋ง์ด ์์ ๊ฒ์ ๋๋ค...