Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalCoinDev committed Jan 15, 2024
1 parent 5aecb2e commit 0015024
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/core/UBlockChain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,6 @@ function TPCBank.DoSaveBank: Boolean;
LBankfilename,Laux_newfilename: AnsiString;
ms : TMemoryStream;
LTC : TTickCount;
LOldB : Boolean;
begin
Result := true;
LBankfilename := GetSafeboxCheckpointingFileName(GetStorageFolder(Orphan),BlocksCount);
Expand Down Expand Up @@ -1142,16 +1141,7 @@ function TPCBank.DoSaveBank: Boolean;
end;
end;
end;
// Flush pending
if (FStorage is TAbstractMemBlockchainStorage) then begin
LOldB := TAbstractMemBlockchainStorage(FStorage).UseMultithread;
TAbstractMemBlockchainStorage(FStorage).UseMultithread := False;
TAbstractMemBlockchainStorage(FStorage).UseMultithread := LOldB;

end;
end;


end;

procedure TPCBank.UpdateValuesFromSafebox;
Expand Down
9 changes: 9 additions & 0 deletions src/core/UPCAbstractMem.pas
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ procedure TPCAbstractMem.FlushCache;
end;
Inc(FStats.FlushesCount);
Inc(Fstats.FlushesMillis, TPlatform.GetElapsedMilliseconds(Ltc) );
TLog.NewLog(ltdebug,Self.ClassName,Format('AbstractMem Safebox flushed in %.2f seconds',[TPlatform.GetElapsedMilliseconds(Ltc)/1000]));
end;

Procedure DoCopyFile(const ASource, ADest : String);
Expand Down Expand Up @@ -795,6 +796,7 @@ procedure TPCAbstractMem.SetUseCacheOnAbstractMemLists(const Value: Boolean);

procedure TPCAbstractMem.UpdateSafeboxFileName(const ANewSafeboxFileName: String);
var LReadOnly, Ltmp : Boolean;
LCacheMem : TCacheMem;
begin
if SameFileName(FFileName,ANewSafeboxFileName) then Exit;

Expand All @@ -812,6 +814,13 @@ procedure TPCAbstractMem.UpdateSafeboxFileName(const ANewSafeboxFileName: String
end;
if FAbstractMem is TFileMem then begin
TFileMem(FAbstractMem).SetCachePerformance(True,1024,FMaxMemUsage,200000);
LCacheMem := TFileMem(FAbstractMem).LockCache;
Try
LCacheMem.OnFlushedCache := OnCacheMemFlushedCache;
LCacheMem.OnLog := OnCacheMemLog;
Finally
TFileMem(FAbstractMem).UnlockCache;
End;
end;
DoInit(Ltmp);
end;
Expand Down

0 comments on commit 0015024

Please sign in to comment.