Skip to content

Commit

Permalink
[process] In disk swapper, create directories to report swapping even…
Browse files Browse the repository at this point in the history
… for empty processes
  • Loading branch information
mcopik committed Oct 18, 2024
1 parent c4d3b63 commit a06e438
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion process/controller/src/swapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ namespace praas::process::swapper {
fs::path full_path = fs::path{swap_location} / location / "state";
if(fs::exists(full_path)) {

// There is at least some info.
success = true;

spdlog::debug("Reading state swap data from {}", full_path.string());
success = _process_swapin_dir(full_path,
[&mailbox](const std::string& key, runtime::internal::Buffer<char> && data) mutable {
Expand Down Expand Up @@ -156,7 +159,9 @@ namespace praas::process::swapper {
return true;
}
);

if(!success) {
return false;
}
}

full_path = fs::path{swap_location} / location / "files";
Expand All @@ -180,6 +185,11 @@ namespace praas::process::swapper {
{
size_t total_size = 0;

// Create directory even if nothing present - just to make
fs::create_directories(fs::path{swap_location} / location / "state");
fs::create_directories(fs::path{swap_location} / location / "messages");
fs::create_directories(fs::path{swap_location} / location / "file");

for(const auto& [key, message] : msgs) {

fs::path full_path;
Expand Down

0 comments on commit a06e438

Please sign in to comment.