Skip to content

Commit

Permalink
Making a send synchronous
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 16, 2024
1 parent 8a11923 commit 426ae35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 10 additions & 6 deletions src/wrench/services/storage/simple/SimpleStorageService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ namespace wrench {

bool file_found = this->file_system->file_exists(location->getFilePath());

answer_commport->dputMessage(
new StorageServiceFileLookupAnswerMessage(
location->getFile(),
file_found,
this->getMessagePayloadValue(
SimpleStorageServiceMessagePayload::FILE_LOOKUP_ANSWER_MESSAGE_PAYLOAD)));
try {
// Synchronous so that it won't be overtaken by an MQ message
answer_commport->putMessage(
new StorageServiceFileLookupAnswerMessage(
location->getFile(),
file_found,
this->getMessagePayloadValue(
SimpleStorageServiceMessagePayload::FILE_LOOKUP_ANSWER_MESSAGE_PAYLOAD)));
} catch (ExecutionException &ignore) {} // Oh, well

return true;
}

Expand Down
8 changes: 5 additions & 3 deletions test/workflow/WorkflowFileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ TEST(DataFileTest, FileStructure) {
ASSERT_EQ(f1->getID(), "file-01");
ASSERT_EQ(f1->getSize(), 100);

ASSERT_EQ(wrench::Simulation::addFile("file-02", "100MB")->getSize(), 100000000ULL);
ASSERT_EQ(wrench::Simulation::addFile("file-03", "100MiB")->getSize(), 100ULL * 1024ULL * 1024ULL);
ASSERT_THROW(wrench::Simulation::addFile("file-03", "100MXiB")->getSize(), std::invalid_argument);
auto size2 = wrench::Simulation::addFile("file-02", "100MB")->getSize();
ASSERT_EQ(size2, 100000000ULL);
auto size3 = wrench::Simulation::addFile("file-03", "100MiB")->getSize();
ASSERT_EQ(size3, 100ULL * 1024ULL * 1024ULL);
ASSERT_THROW(wrench::Simulation::addFile("file-04", "100MXiB"), std::invalid_argument);

workflow->clear();
wrench::Simulation::removeAllFiles();
Expand Down

0 comments on commit 426ae35

Please sign in to comment.