Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,11 @@ endif()
include(CTest)
include(Catch)
if(BUILD_TESTING)
if(APPLE)
# On macOS, only build tests for debug builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_subdirectory(test/cpp)
endif()
elseif(CMAKE_CROSSCOMPILING)
if(CMAKE_CROSSCOMPILING)
# Skip running tests when cross-compiling
message(STATUS "Skipping tests during cross-compilation")
else()
# On other platforms (Linux), build tests for all configurations
# Build tests for all platforms and configurations
add_subdirectory(test/cpp)
endif()
endif()
Expand Down
10 changes: 6 additions & 4 deletions src/caching_file_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,18 @@ std::string CachingFileProvider::ReadFile(const std::string& path) {
evictLRU(content_size);
}

// Add to cache
// Add to cache only if not already inserted by a concurrent thread
CacheEntry entry;
entry.content = content;
entry.expires_at = std::chrono::steady_clock::now() + _config.ttl;
entry.last_access = std::chrono::steady_clock::now();
entry.size_bytes = content_size;

_cache[path] = std::move(entry);
_stats.current_entries.fetch_add(1);
_stats.current_size_bytes.fetch_add(content_size);
auto [it, inserted] = _cache.emplace(path, std::move(entry));
if (inserted) {
_stats.current_entries.fetch_add(1);
_stats.current_size_bytes.fetch_add(content_size);
}
}

return content;
Expand Down
10 changes: 7 additions & 3 deletions test/integration/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = []

[project]
name = "flapi-integration-tests"
version = "0.1.0"
Expand All @@ -20,9 +27,6 @@ dependencies = [
"psutil>=5.9.0",
]

[tool.setuptools]
packages = []

[tool.pytest.ini_options]
addopts = "-v"
testpaths = ["."]
Expand Down
Loading