Browse Source

Add a "test routine" for redis DB and call restoration. Takes less than 2 seconds to restore 3000 calls.

Fix the "ports used" array.
git.mgm/mediaproxy-ng/2.0
Richard Fuchs 15 years ago
parent
commit
267b8a9ce4
2 changed files with 31 additions and 1 deletions
  1. +1
    -1
      daemon/call.c
  2. +30
    -0
      daemon/redis.c

+ 1
- 1
daemon/call.c View File

@ -35,7 +35,7 @@ static pcre_extra *info_ree;
static pcre *streams_re;
static pcre_extra *streams_ree;
static BIT_ARRAY_DECLARE(ports_used, 0x1000);
static BIT_ARRAY_DECLARE(ports_used, 0x10000);


+ 30
- 0
daemon/redis.c View File

@ -14,6 +14,36 @@
/*
To fill the redis DB with expiring test data:
num=3000
db=1
expire=86400
for x in $(seq 1 $num); do
b=$(uuid)
echo "hmset $b callid $(uuid)@test created $(date +%s)"
c=$(uuid)
echo "rpush $b-streams $c"
echo "hmset $c:0 ip $(($RANDOM % 253 + 1)).$(($RANDOM % 253 + 1)).$(($RANDOM % 253 + 1)).$(($RANDOM % 253 + 1)) port $(($RANDOM % 10000 + 1024)) localport $(($RANDOM % 10000 + 1024)) kernel 1 filled 1 confirmed 1 tag $(uuid)"
echo "hmset $c:1 ip $(($RANDOM % 253 + 1)).$(($RANDOM % 253 + 1)).$(($RANDOM % 253 + 1)).$(($RANDOM % 253 + 1)) port $(($RANDOM % 10000 + 1024)) localport $(($RANDOM % 10000 + 1024)) kernel 1 filled 1 confirmed 1 tag $(uuid)"
echo "expire $b $expire"
echo "expire $b-streams $expire"
echo "expire $c:0 $expire"
echo "expire $c:1 $expire"
echo "sadd calls $b"
done | redis-cli -n $db
*/
#define redisCommandNR(a...) (int)({ void *__tmp; __tmp = redisCommand(a); if (__tmp) freeReplyObject(__tmp); __tmp ? 0 : -1;})


Loading…
Cancel
Save