mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 12:16:53 +00:00
Reload scripts across the whole cluster if one shard is missing the script.
This commit is contained in:
1 parent
2d697ac8db
commit
1b53f10091
2 files changed
+22
-32
No files matched your search
@@ -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