Skip to content

Commit

Permalink
don't use DEL while it's crushing the system
Browse files Browse the repository at this point in the history
  • Loading branch information
daTokenizer committed Dec 4, 2016
1 parent 641a244 commit b443135
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
26 changes: 13 additions & 13 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
Expand Down Expand Up @@ -977,10 +978,9 @@ int PollCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
return REDISMODULE_OK;
}


int TestLook(RedisModuleCtx *ctx)
{
RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_look");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_look");
printf("Testing Look - ");

// size_t len
Expand Down Expand Up @@ -1009,15 +1009,15 @@ int TestLook(RedisModuleCtx *ctx)
RedisModule_Call(ctx, "REDE.look", "cc", "TEST_DEHYDRATOR_look", "test_element");
RMUtil_Assert(!RedisModule_CreateStringFromCallReply(check3));

RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_look");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_look");
printf("Passed.\n");
return REDISMODULE_OK;
}


int TestUpdate(RedisModuleCtx *ctx)
{
RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_update");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_update");
printf("Testing Update - ");

RedisModuleCallReply *check1 =
Expand Down Expand Up @@ -1046,15 +1046,15 @@ int TestUpdate(RedisModuleCtx *ctx)
RedisModule_Call(ctx, "REDE.update", "ccc", "TEST_DEHYDRATOR_update", "test_element", "text");
RMUtil_Assert(RedisModule_CallReplyType(check4) == REDISMODULE_REPLY_ERROR);

RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_update");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_update");
printf("Passed.\n");
return REDISMODULE_OK;
}


int TestTimeToNext(RedisModuleCtx *ctx)
{
RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_ttn");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_ttn");
printf("Testing TTN - ");

RedisModuleCallReply *push1 =
Expand All @@ -1081,15 +1081,15 @@ int TestTimeToNext(RedisModuleCtx *ctx)
RMUtil_Assert(RedisModule_CallReplyInteger(check3) == 0);


RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_ttn");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_ttn");
printf("Passed.\n");
return REDISMODULE_OK;
}


int TestPush(RedisModuleCtx *ctx)
{
RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_push");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_push");
printf("Testing Push - ");
// char * element_id = "push_test_element";
// size_t len
Expand All @@ -1111,15 +1111,15 @@ int TestPush(RedisModuleCtx *ctx)
// TODO: test pushing more then one element
// TODO: add fail-case tests

RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_push");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_push");
printf("Passed.\n");
return REDISMODULE_OK;
}


int TestPull(RedisModuleCtx *ctx)
{
RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_pull");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_pull");
printf("Testing Pull - ");

char * store_key = "pull_test_element";
Expand Down Expand Up @@ -1158,7 +1158,7 @@ int TestPull(RedisModuleCtx *ctx)
RMUtil_Assert(!RedisModule_CreateStringFromCallReply(look3));

printf("Passed.\n");
RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_pull");;
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_pull");
return REDISMODULE_OK;
}

Expand All @@ -1168,7 +1168,7 @@ int TestPoll(RedisModuleCtx *ctx)
printf("Testing Poll - ");

// clear dehydrator
RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_poll");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_poll");

// start test
// push elements 1, 4, 7 & 3a (for 1, 4, 7 & 3 seconds)
Expand Down Expand Up @@ -1259,7 +1259,7 @@ int TestPoll(RedisModuleCtx *ctx)
RMUtil_Assert(RedisModule_CallReplyLength(poll_five_rep) == 0);

// clear dehydrator
RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_poll");
// RedisModule_Call(ctx, "DEL", "c", "TEST_DEHYDRATOR_poll");
printf("Passed.\n");
return REDISMODULE_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/helloworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def helloworld(redis_service):
t3_poll_result = redis_service.execute_command("rede.poll", "helloworld_dehydrator")

print t3_poll_result[0], t1_poll_result[0]
redis_service.execute_command("DEL", "helloworld_dehydrator")
# redis_service.execute_command("DEL", "helloworld_dehydrator")


if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def run_internal_test(redis_service):
print(redis_service.execute_command("rede.test"))

def function_test_dehydrator(redis_service):
redis_service.execute_command("DEL", "python_test_dehydrator")
# redis_service.execute_command("DEL", "python_test_dehydrator")
sys.stdout.write("module functional test (external) - ")
sys.stdout.flush()
# "push elements a,b & c (for 1,3 & 7 seconds)"
Expand Down Expand Up @@ -38,10 +38,10 @@ def function_test_dehydrator(redis_service):
# (t1_poll_result)
assert(len(t1_poll_result) == 1 and t1_poll_result[0] == "test_element c")
print("PASS")
redis_service.execute_command("DEL", "python_test_dehydrator")
# redis_service.execute_command("DEL", "python_test_dehydrator")

def load_test_dehydrator(redis_service, cycles=1000000, timeouts=[1,2,4,16,32,100,200,1000]):
redis_service.execute_command("DEL", "python_load_test_dehydrator")
# redis_service.execute_command("DEL", "python_load_test_dehydrator")
print "starting load tests"

print "measuring PUSH"
Expand Down Expand Up @@ -87,7 +87,7 @@ def load_test_dehydrator(redis_service, cycles=1000000, timeouts=[1,2,4,16,32,10
print "mean push(generating ids) velocity =", cycles/(gid_push_end-push_end), "per second"
print "mean pull velocity =", cycles/(pull_end-gid_push_end), "per second"
print "mean poll velocity = ", cycles/poll_sum, "per second"
redis_service.execute_command("DEL", "python_load_test_dehydrator")
# redis_service.execute_command("DEL", "python_load_test_dehydrator")

if __name__ == "__main__":
r = redis.StrictRedis(host='localhost', port=6379, db=0)
Expand Down

0 comments on commit b443135

Please sign in to comment.