Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Runtime/BacktraceDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ internal void Update()
}
if (_breadcrumbs != null)
{
_breadcrumbs.Update();
_breadcrumbs.Update(Time.unscaledTime);
}
LastFrameTime = Time.unscaledTime;
if (!DatabaseSettings.AutoSendMode)
Expand Down
4 changes: 2 additions & 2 deletions Runtime/Model/Breadcrumbs/BacktraceBreadcrumbs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ public double BreadcrumbId()
return LogManager.BreadcrumbId();
}

public void Update()
public void Update(float time)
{
EventHandler.Update();
EventHandler.Update(time);
}

public static bool CanStoreBreadcrumbs(UnityEngineLogLevel logLevel, BacktraceBreadcrumbType backtraceBreadcrumbsLevel)
Expand Down
11 changes: 10 additions & 1 deletion Runtime/Model/Breadcrumbs/BacktraceBreadcrumbsEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ internal sealed class BacktraceBreadcrumbsEventHandler
private BacktraceBreadcrumbType _registeredLevel;
private NetworkReachability _networkStatus = NetworkReachability.NotReachable;
private Thread _thread;
private float _lastUpdateTime = 0;

// time in seconds between internet availability checks
private float INTERNET_AVAILABILITY_CHECK_INTERVAL_SEC = 30;
public BacktraceBreadcrumbsEventHandler(BacktraceBreadcrumbs breadcrumbs)
{
_thread = Thread.CurrentThread;
Expand Down Expand Up @@ -151,8 +155,13 @@ private void LogNewNetworkStatus(NetworkReachability status)
Log(string.Format("Network:{0}", status), LogType.Log, BreadcrumbLevel.System);
}

internal void Update()
internal void Update(float time)
{
if (time - _lastUpdateTime < INTERNET_AVAILABILITY_CHECK_INTERVAL_SEC && _lastUpdateTime != 0)
{
return;
}
_lastUpdateTime = time;
if (_registeredLevel.HasFlag(BacktraceBreadcrumbType.System) && Application.internetReachability != _networkStatus)
{
LogNewNetworkStatus(Application.internetReachability);
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Model/Breadcrumbs/IBacktraceBreadcrumbs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IBacktraceBreadcrumbs
string GetBreadcrumbLogPath();
double BreadcrumbId();
void UnregisterEvents();
void Update();
void Update(float time);
string Archive();
}
}