mirror of
https://github.com/bitwarden/android.git
synced 2024-12-27 11:28:28 +03:00
[SG-687] added try catch to cancellation token disposal. (#2114)
This commit is contained in:
parent
1db4c4fc8b
commit
c1101af582
1 changed files with 19 additions and 5 deletions
|
@ -71,17 +71,31 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopRequestTimeUpdater()
|
public void StopRequestTimeUpdater()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_requestTimeCts?.Cancel();
|
_requestTimeCts?.Cancel();
|
||||||
_requestTimeCts?.Dispose();
|
_requestTimeCts?.Dispose();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.Exception(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void StartRequestTimeUpdater()
|
public void StartRequestTimeUpdater()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_requestTimeCts?.Cancel();
|
_requestTimeCts?.Cancel();
|
||||||
_requestTimeCts = new CancellationTokenSource();
|
_requestTimeCts = new CancellationTokenSource();
|
||||||
_requestTimeTask = new TimerTask(_logger, UpdateRequestTime, _requestTimeCts).RunPeriodic(TimeSpan.FromMinutes(REQUEST_TIME_UPDATE_PERIOD_IN_MINUTES));
|
_requestTimeTask = new TimerTask(_logger, UpdateRequestTime, _requestTimeCts).RunPeriodic(TimeSpan.FromMinutes(REQUEST_TIME_UPDATE_PERIOD_IN_MINUTES));
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.Exception(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task UpdateRequestTime()
|
private async Task UpdateRequestTime()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue