mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 11:08:05 +01:00
Reload scripts across the whole cluster if one shard is missing the script.
This commit is contained in:
committed by
Jon Chambers
parent
2d697ac8db
commit
1b53f10091
@@ -64,7 +64,7 @@ public class ClusterLuaScript {
|
||||
try {
|
||||
return clusterCommands.evalsha(sha, scriptOutputType, keys.toArray(STRING_ARRAY), args.toArray(STRING_ARRAY));
|
||||
} catch (final RedisNoScriptException e) {
|
||||
clusterCommands.scriptLoad(script);
|
||||
reloadScript();
|
||||
return clusterCommands.evalsha(sha, scriptOutputType, keys.toArray(STRING_ARRAY), args.toArray(STRING_ARRAY));
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
@@ -82,7 +82,7 @@ public class ClusterLuaScript {
|
||||
try {
|
||||
return binaryCommands.evalsha(sha, scriptOutputType, keys.toArray(BYTE_ARRAY_ARRAY), args.toArray(BYTE_ARRAY_ARRAY));
|
||||
} catch (final RedisNoScriptException e) {
|
||||
binaryCommands.scriptLoad(script.getBytes(StandardCharsets.UTF_8));
|
||||
reloadScript();
|
||||
return binaryCommands.evalsha(sha, scriptOutputType, keys.toArray(BYTE_ARRAY_ARRAY), args.toArray(BYTE_ARRAY_ARRAY));
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
@@ -91,4 +91,8 @@ public class ClusterLuaScript {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void reloadScript() {
|
||||
redisCluster.useCluster(connection -> connection.sync().upstream().commands().scriptLoad(script));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user