@@ -148,6 +148,20 @@ describe('Redis Integration Tests', () => {
148148 store = new RedisStore ( {
149149 async sendCommandCluster ( details : SendCommandClusterDetails ) {
150150 const { command } = details
151+
152+ // If SCRIPT LOAD, send to all master nodes
153+ if ( command [ 0 ] === 'SCRIPT' && command [ 1 ] === 'LOAD' ) {
154+ const nodes = client . nodes ( 'master' )
155+ await Promise . all (
156+ nodes . map ( async ( node ) =>
157+ node . call ( command [ 0 ] , ...command . slice ( 1 ) ) ,
158+ ) ,
159+ )
160+ // Return the result from one of them (they should be identical)
161+ const result = await client . call ( command [ 0 ] , ...command . slice ( 1 ) )
162+ return result as RedisReply
163+ }
164+
151165 const result = await client . call ( command [ 0 ] , ...command . slice ( 1 ) )
152166 return result as RedisReply
153167 } ,
@@ -203,6 +217,19 @@ describe('Redis Integration Tests', () => {
203217 const shortStore = new RedisStore ( {
204218 async sendCommandCluster ( details : SendCommandClusterDetails ) {
205219 const { command } = details
220+
221+ // If SCRIPT LOAD, send to all master nodes
222+ if ( command [ 0 ] === 'SCRIPT' && command [ 1 ] === 'LOAD' ) {
223+ const nodes = client . nodes ( 'master' )
224+ await Promise . all (
225+ nodes . map ( async ( node ) =>
226+ node . call ( command [ 0 ] , ...command . slice ( 1 ) ) ,
227+ ) ,
228+ )
229+ const result = await client . call ( command [ 0 ] , ...command . slice ( 1 ) )
230+ return result as RedisReply
231+ }
232+
206233 const result = await client . call ( command [ 0 ] , ...command . slice ( 1 ) )
207234 return result as RedisReply
208235 } ,
0 commit comments