mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-22 16:01:16 +01:00
flush redis after connection established, improve bulk.sh
This commit is contained in:
parent
e35106a03b
commit
f71f11aa87
@ -8,12 +8,12 @@ function connect_redis() {
|
|||||||
var redisURL = require("url").parse(process.env.REDISCLOUD_URL);
|
var redisURL = require("url").parse(process.env.REDISCLOUD_URL);
|
||||||
redis = require("redis").createClient(redisURL.port, redisURL.hostname);
|
redis = require("redis").createClient(redisURL.port, redisURL.hostname);
|
||||||
redis.auth(redisURL.auth.split(":")[1]);
|
redis.auth(redisURL.auth.split(":")[1]);
|
||||||
redis.flushall();
|
|
||||||
} else {
|
} else {
|
||||||
redis = require("redis").createClient();
|
redis = require("redis").createClient();
|
||||||
}
|
}
|
||||||
redis.on("ready", function() {
|
redis.on("ready", function() {
|
||||||
console.log("Redis connection established.");
|
console.log("Redis connection established.");
|
||||||
|
redis.flushall();
|
||||||
});
|
});
|
||||||
redis.on("error", function (err) {
|
redis.on("error", function (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
host="$1"
|
||||||
|
if [ -z "$host" ]; then
|
||||||
|
echo "Usage: $0 <host>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
rm -f "$dir/../skins/"*.png || exit 1
|
rm -f "$dir/../skins/"*.png || exit 1
|
||||||
for uuid in `cat "$dir/uuids.txt"`; do
|
for uuid in `cat "$dir/uuids.txt"`; do
|
||||||
@ -8,5 +13,5 @@ for uuid in `cat "$dir/uuids.txt"`; do
|
|||||||
if [ "$(( ((RANDOM<<15)|RANDOM) % 2 ))" -eq "1" ]; then
|
if [ "$(( ((RANDOM<<15)|RANDOM) % 2 ))" -eq "1" ]; then
|
||||||
helm="&helm"
|
helm="&helm"
|
||||||
fi
|
fi
|
||||||
curl -sS -o /dev/null -w "%{url_effective} %{http_code} %{time_total}s\\n" "http://crafatar.com/avatars/$uuid?size=$size$helm" || exit 1
|
curl -sSL -o /dev/null -w "%{url_effective} %{http_code} %{time_total}s\\n" "http://$host/avatars/$uuid?size=$size$helm" || exit 1
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user