Skip to content

Commit

Permalink
Command line publish: forget referenced buckets when finished
Browse files Browse the repository at this point in the history
  • Loading branch information
marta-lokhova committed Apr 22, 2020
1 parent 0841e1e commit a302a62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/ApplicationUtils.cpp
Expand Up @@ -4,6 +4,7 @@

#include "main/ApplicationUtils.h"
#include "bucket/Bucket.h"
#include "bucket/BucketManager.h"
#include "catchup/ApplyBucketsWork.h"
#include "catchup/CatchupConfiguration.h"
#include "database/Database.h"
Expand Down Expand Up @@ -438,8 +439,7 @@ publish(Application::pointer app)
asio::io_context::work mainWork(io);

auto lcl = app->getLedgerManager().getLastClosedLedgerNum();
auto isCheckpoint =
lcl == app->getHistoryManager().checkpointContainingLedger(lcl);
auto isCheckpoint = app->getHistoryManager().isLastLedgerInCheckpoint(lcl);
auto expectedPublishQueueSize = isCheckpoint ? 1 : 0;

app->getHistoryManager().publishQueuedHistory();
Expand All @@ -449,6 +449,9 @@ publish(Application::pointer app)
{
}

// Cleanup buckets not referenced by publish queue anymore
app->getBucketManager().forgetUnreferencedBuckets();

LOG(INFO) << "*";
LOG(INFO) << "* Publish finished.";
LOG(INFO) << "*";
Expand Down

0 comments on commit a302a62

Please sign in to comment.