resolve database caching issues
This commit is contained in:
@@ -54,9 +54,9 @@ $HTTP["url"] =~ "^/INSTANCE/data/icao_.*\.json$" {
|
||||
"Cache-Control" => "public, max-age=10",
|
||||
)
|
||||
}
|
||||
$HTTP["url"] =~ "^/INSTANCE/db2/.*\.json$" {
|
||||
$HTTP["url"] =~ "^/INSTANCE/db.*\.json$" {
|
||||
setenv.add-response-header += (
|
||||
"Cache-Control" => "public, max-age=100000",
|
||||
"Cache-Control" => "public, max-age=1209600",
|
||||
)
|
||||
}
|
||||
$HTTP["url"] =~ "^/INSTANCE/.*\.png$" {
|
||||
|
||||
@@ -73,7 +73,7 @@ function request_from_db(icao, level, defer) {
|
||||
|
||||
function getIcaoAircraftTypeData(aircraftData, defer) {
|
||||
if (_aircraft_type_cache === null) {
|
||||
$.getJSON("db2/icao_aircraft_types.json")
|
||||
$.getJSON(databaseFolder + "/icao_aircraft_types.json")
|
||||
.done(function(typeLookupData) {
|
||||
_aircraft_type_cache = typeLookupData;
|
||||
})
|
||||
@@ -136,7 +136,7 @@ function db_ajax_request_complete() {
|
||||
} else {
|
||||
_request_count++;
|
||||
req = _request_queue.shift();
|
||||
const req_url = 'db2/' + req.bkey + '.json';
|
||||
const req_url = databaseFolder + '/' + req.bkey + '.json';
|
||||
ajaxreq = $.ajax({ url: req_url,
|
||||
cache: true,
|
||||
timeout: 30000,
|
||||
|
||||
@@ -15,6 +15,8 @@ var configureReceiver = $.Deferred();
|
||||
var historyTimeout = 60;
|
||||
var globeIndex = 0;
|
||||
|
||||
var databaseFolder = "db2";
|
||||
|
||||
var uuid = null;
|
||||
|
||||
try {
|
||||
|
||||
@@ -564,11 +564,11 @@ function initialize() {
|
||||
// Wait for history item downloads and append them to the buffer
|
||||
push_history();
|
||||
// this will be needed later
|
||||
$.getJSON("db2/icao_aircraft_types.json")
|
||||
$.getJSON(databaseFolder + "/icao_aircraft_types.json")
|
||||
.done(function(typeLookupData) {
|
||||
_aircraft_type_cache = typeLookupData;
|
||||
})
|
||||
$.getJSON("db2/airport-coords.json")
|
||||
$.getJSON(databaseFolder + "/airport-coords.json")
|
||||
.done(function(data) {
|
||||
_airport_coords_cache = data;
|
||||
const search = new URLSearchParams(window.location.search);
|
||||
|
||||
@@ -65,6 +65,9 @@ then
|
||||
git reset --hard origin/master
|
||||
fi
|
||||
|
||||
cd $ipath/git-db
|
||||
DB_VERSION=$(git rev-parse --short HEAD)
|
||||
|
||||
cd "$dir"
|
||||
|
||||
if [[ "$1" == "test" ]]
|
||||
@@ -174,7 +177,8 @@ do
|
||||
rm -rf $html_path 2>/dev/null || true
|
||||
cp -r -T html $html_path
|
||||
mkdir -p $html_path/db2
|
||||
cp -r -T $ipath/git-db/db $html_path/db2
|
||||
cp -r -T $ipath/git-db/db $html_path/db-$DB_VERSION
|
||||
sed -i -e "s/var databaseFolder = .*/var databaseFolder = \"db-$DB_VERSION\";/" $html_path/early.js
|
||||
|
||||
mv /tmp/tar1090_config.js $html_path/config.js 2>/dev/null || true
|
||||
mv /tmp/tar1090_colors.css $html_path/colors.css 2>/dev/null || true
|
||||
|
||||
@@ -18,7 +18,7 @@ location /INSTANCE/data/ {
|
||||
}
|
||||
location ~ globe_.*\.json$ {
|
||||
gzip off;
|
||||
add_header Cache-Control "public, max-age=2";
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
}
|
||||
@@ -53,8 +53,8 @@ location /INSTANCE {
|
||||
|
||||
gzip_static on;
|
||||
|
||||
location ~ db2/.*\.json$ {
|
||||
add_header Cache-Control "public, max-age=100000";
|
||||
location ~ db.*\.json$ {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
}
|
||||
location ~ .*\.png$ {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
|
||||
Reference in New Issue
Block a user