Skip to content

Commit 3973d30

Browse files
committed
Fix SCRIPTSCAN and add test
1 parent 352f852 commit 3973d30

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/redisai.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,11 +790,13 @@ int RedisAI_ScriptScan_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **arg
790790

791791
RedisModule_ReplyWithArray(ctx, nkeys);
792792

793+
RedisModuleString *empty_tag = RedisModule_CreateString(NULL, "", 0);
793794
for (long long i = 0; i < nkeys; i++) {
794795
RedisModule_ReplyWithArray(ctx, 2);
795796
RedisModule_ReplyWithString(ctx, keys[i]);
796-
RedisModule_ReplyWithString(ctx, tags[i]);
797+
RedisModule_ReplyWithString(ctx, tags[i] ? tags[i] : empty_tag);
797798
}
799+
RedisModule_FreeString(NULL, empty_tag);
798800

799801
RedisModule_Free(keys);
800802
RedisModule_Free(tags);

tests/flow/tests_pytorch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ def test_pytorch_modelscan_scriptscan(env):
859859
ret = con.execute_command('AI.MODELSET', 'm1', 'TORCH', DEVICE, 'TAG', 'm:v1', 'BLOB', model_pb)
860860
env.assertEqual(ret, b'OK')
861861

862-
ret = con.execute_command('AI.MODELSET', 'm2', 'TORCH', DEVICE, 'TAG', 'm:v1', 'BLOB', model_pb)
862+
ret = con.execute_command('AI.MODELSET', 'm2', 'TORCH', DEVICE, 'BLOB', model_pb)
863863
env.assertEqual(ret, b'OK')
864864

865865
script_filename = os.path.join(test_data_path, 'script.txt')
@@ -870,7 +870,7 @@ def test_pytorch_modelscan_scriptscan(env):
870870
ret = con.execute_command('AI.SCRIPTSET', 's1', DEVICE, 'TAG', 's:v1', 'SOURCE', script)
871871
env.assertEqual(ret, b'OK')
872872

873-
ret = con.execute_command('AI.SCRIPTSET', 's2', DEVICE, 'TAG', 's:v1', 'SOURCE', script)
873+
ret = con.execute_command('AI.SCRIPTSET', 's2', DEVICE, 'SOURCE', script)
874874
env.assertEqual(ret, b'OK')
875875

876876
ensureSlaveSynced(con, env)

0 commit comments

Comments
 (0)