Skip to content

Commit

Permalink
Merge pull request #328 from KNMI/315-fixopendap
Browse files Browse the repository at this point in the history
315 fixopendap
  • Loading branch information
maartenplieger authored Jan 22, 2024
2 parents 59483e3 + 80c7974 commit 6a254f3
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
"variant": "cpp",
"shared_mutex": "cpp",
"regex": "cpp",
"numbers": "cpp"
"numbers": "cpp",
"compare": "cpp",
"concepts": "cpp"
},
"cmake.buildDirectory": "${workspaceFolder}/bin",
"cmake.configureOnOpen": true,
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ USER root
LABEL maintainer="adaguc@knmi.nl"

# Version should be same as in Definitions.h
LABEL version="2.14.2"
LABEL version="2.14.3"

# Try to update image packages
RUN apt-get -q -y update \
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**Version 2.14.3 2024-01-19**
- Opendap services are accessible again in the Layer configuration: https://github.com/KNMI/adaguc-server/issues/315

**Version 2.14.2 2024-01-15**
- Fix issue where the wrong dimension was forced to a value
- Add Cache-Control header to WCS requests (DescribeCoverage and GetCoverage)
Expand Down
4 changes: 0 additions & 4 deletions adagucserverEC/CDBFileScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,6 @@ int CDBFileScanner::DBLoopFiles(CDataSource *dataSource, int removeNonExistingFi
}

for (size_t j = 0; j < fileList->size(); j++) {
if (!CDirReader::isFile((*fileList)[j].c_str())) {
CDBWarning("File [%s] does not exist anymore, skipping", (*fileList)[j].c_str());
continue;
}
// Loop through all configured dimensions.
#ifdef CDBFILESCANNER_DEBUG
CDBDebug("Loop through all configured dimensions.");
Expand Down
2 changes: 2 additions & 0 deletions adagucserverEC/CDBFileScannerCleanFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ int CDBFileScanner::cleanFiles(CDataSource *dataSource, int) {
CDBError("Unable to remove file from FS: [%s]", fileNamestr.c_str());
} else {
filesDeletedFromFS.insert(fileNamestr);
// File is not present anymore, also remove it from the dirreaders
CCachedDirReader::removeFileFromCachedList(fileNamestr);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion adagucserverEC/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef Definitions_H
#define Definitions_H

#define ADAGUCSERVER_VERSION "2.14.2" // Please also update in the Dockerfile to the same version
#define ADAGUCSERVER_VERSION "2.14.3" // Please also update in the Dockerfile to the same version

// CConfigReaderLayerType
#define CConfigReaderLayerTypeUnknown 0
Expand Down
12 changes: 12 additions & 0 deletions hclasses/CDirReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,18 @@ CDirReader *CCachedDirReader::getDirReader(const char *directory, const char *ex
return 0;
}

void CCachedDirReader::removeFileFromCachedList(std::string fileToRemove) {
for (auto i : dirReaderMap) {
CDirReader *dirReader = i.second;
// Find the file in the vector
auto itr = std::find(dirReader->fileList.begin(), dirReader->fileList.end(), fileToRemove);
// If found, remove it from the vector
if (itr != dirReader->fileList.end()) {
dirReader->fileList.erase(itr);
}
}
}

void CCachedDirReader::free() {
for (std::map<std::string, CDirReader *>::iterator it = dirReaderMap.begin(); it != dirReaderMap.end(); ++it) {
delete it->second;
Expand Down
1 change: 1 addition & 0 deletions hclasses/CDirReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class CCachedDirReader {
public:
static void free();
static CDirReader *getDirReader(const char *directory, const char *ext_filter);
static void removeFileFromCachedList(std::string fileToRemove);
};

#endif
1 change: 0 additions & 1 deletion tests/AdagucTests/TestWMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -2437,4 +2437,3 @@ def test_WMSGetMap_WithCaching(self):
self.assertEqual(
headers, ["Content-Type:image/png", "Cache-Control:max-age=60"]
)
AdagucTestTools().writetofile("test1.png", data.getvalue())

0 comments on commit 6a254f3

Please sign in to comment.