mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Flush memcached whenever we drop the databases.
This fixes some issues that we've had where commands will fail is confusing ways after the database is rebuilt because data from before the database was dropped is still in the memcached cache.
This commit is contained in:
4
scripts/setup/flush-memcached
Executable file
4
scripts/setup/flush-memcached
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh -xe
|
||||
|
||||
# Flush memcached
|
||||
echo 'flush_all' | nc localhost 11211
|
||||
@@ -15,5 +15,7 @@ CREATE SCHEMA zulip AUTHORIZATION zulip;
|
||||
CREATE EXTENSION tsearch_extras SCHEMA zulip;
|
||||
EOF
|
||||
|
||||
sh "$(dirname "$0")/flush-memcached"
|
||||
|
||||
echo "Database created"
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ DROP DATABASE IF EXISTS zulip;
|
||||
CREATE DATABASE zulip TEMPLATE zulip_base;
|
||||
EOF
|
||||
|
||||
sh "$(dirname "$0")/../scripts/setup/flush-memcached"
|
||||
|
||||
python manage.py migrate --noinput
|
||||
python manage.py createcachetable third_party_api_results
|
||||
python manage.py populate_db -n100 --threads=1
|
||||
|
||||
@@ -15,6 +15,7 @@ if [ "$template_grep_error_code" == "0" ]; then
|
||||
DROP DATABASE IF EXISTS zulip_test;
|
||||
CREATE DATABASE zulip_test TEMPLATE zulip_test_template;
|
||||
EOF
|
||||
sh "$(dirname "$0")/../scripts/setup/flush-memcached"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
@@ -25,6 +26,7 @@ psql -h localhost postgres zulip_test <<EOF
|
||||
DROP DATABASE IF EXISTS zulip_test;
|
||||
CREATE DATABASE zulip_test TEMPLATE zulip_test_base;
|
||||
EOF
|
||||
sh "$(dirname "$0")/../scripts/setup/flush-memcached"
|
||||
|
||||
python manage.py migrate --noinput --settings=zproject.test_settings
|
||||
migration_status "zerver/fixtures/migration-status"
|
||||
|
||||
@@ -67,5 +67,7 @@ psql -h localhost postgres "$USERNAME" <<EOF
|
||||
CREATE DATABASE $DBNAME TEMPLATE $DBNAME_BASE;
|
||||
EOF
|
||||
|
||||
sh "$(dirname "$0")/../scripts/setup/flush-memcached"
|
||||
|
||||
echo "Database created"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user