Browse Source

GUI: throttle balance refresh on event burst start and end, for non-sync scenario

Herman Schoenfeld 7 years ago
parent
commit
a188530525
2 changed files with 3 additions and 3 deletions
  1. 1 1
      src/gui/UCTRLWallet.pas
  2. 2 2
      src/libraries/sphere10/UCommon.pas

+ 1 - 1
src/gui/UCTRLWallet.pas

@@ -129,7 +129,7 @@ begin
   TWallet.Keys.OnChanged.Add(OnPrivateKeysChanged);
   TWallet.Keys.AccountsKeyList.ClearAccountKeyChanges;   // XXXXX CLEAR BUFFER on start
   FBalanceUpdatedEvent := TThrottledEvent.Create(Self);
-  FBalanceUpdatedEvent.Mode := temNotifyOnEventBurstFinished;
+  FBalanceUpdatedEvent.Mode := temNotifyOnEventBurstStartAndFinished;
   FBalanceUpdatedEvent.Interval := TTimeSpan.FromSeconds(10);
   FBalanceUpdatedEvent.Add(OnUserBalanceChanged);
 

+ 2 - 2
src/libraries/sphere10/UCommon.pas

@@ -261,7 +261,7 @@ type
     public const
       CT_DEFAULT_DELAYEDREFRESH_MS = 1000;
     public type
-      TThrottledEventMode = (temNone, temNotifyEveryInterval, temNotifyOnEventBurstFinished);
+      TThrottledEventMode = (temNone, temNotifyEveryInterval, temNotifyOnEventBurstFinished, temNotifyOnEventBurstStartAndFinished);
     private
       FHandler : TNotifyManyEvent;
       FTimer: TTimer;
@@ -1313,7 +1313,7 @@ begin
       else
         FTimer.Interval := ClipValue( Round( Abs ( (FInterval - LDuration).TotalMilliseconds)), 10, High(integer));
     end;
-    temNotifyOnEventBurstFinished: begin
+    temNotifyOnEventBurstStartAndFinished, temNotifyOnEventBurstFinished: begin
       LDuration := TTimeSpan.Subtract(Now, FLastClientNotify);
       if LDuration > FInterval then
         NotifyNow