Also remove the cached FK for the map-id when we delete it from the db >_>

This commit is contained in:
Lukas Rieger (Blue) 2023-03-17 20:29:52 +01:00
parent 1336d26b9f
commit 8af13df3f9
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2

View File

@ -377,6 +377,7 @@ public void deleteMeta(String mapId, String name) throws IOException {
@Override
public void purgeMap(String mapId, Function<ProgressInfo, Boolean> onProgress) throws IOException {
synchronized (mapFKs) {
try {
recoveringConnection(connection -> {
executeUpdate(connection,
@ -397,6 +398,7 @@ public void purgeMap(String mapId, Function<ProgressInfo, Boolean> onProgress) t
mapId
);
executeUpdate(connection,
"DELETE " +
"FROM `bluemap_map` " +
@ -404,10 +406,14 @@ public void purgeMap(String mapId, Function<ProgressInfo, Boolean> onProgress) t
mapId
);
}, 2);
mapFKs.invalidate(mapId);
} catch (SQLException ex) {
throw new IOException(ex);
}
}
}
@Override
public Collection<String> collectMapIds() throws IOException {
@ -670,8 +676,10 @@ private int getMapTileCompressionFK(Compression compression) throws SQLException
}
private int loadMapFK(String mapId) throws SQLException, IOException {
synchronized (mapFKs) {
return lookupFK("bluemap_map", "id", "map_id", mapId);
}
}
private int loadMapTileCompressionFK(Compression compression) throws SQLException, IOException {
return lookupFK("bluemap_map_tile_compression", "id", "compression", compression.getTypeId());