mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix: Github REST API access rate limit (#60)
This commit is contained in:
parent
400d454478
commit
e5be649a2d
2 changed files with 29 additions and 1 deletions
|
@ -227,8 +227,11 @@ namespace SourceGit
|
|||
_notificationReceiver = launcher;
|
||||
desktop.MainWindow = launcher;
|
||||
|
||||
if (ViewModels.Preference.Instance.Check4UpdatesOnStartup)
|
||||
if (ViewModels.Preference.Instance.ShouldCheck4UpdateOnStartup)
|
||||
{
|
||||
ViewModels.Preference.Save();
|
||||
Check4Update();
|
||||
}
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
|
|
|
@ -278,6 +278,31 @@ namespace SourceGit.ViewModels
|
|||
set;
|
||||
} = 0;
|
||||
|
||||
public double LastCheckUpdateTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = 0;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool ShouldCheck4UpdateOnStartup
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_check4UpdatesOnStartup)
|
||||
return false;
|
||||
|
||||
var lastCheck = DateTime.UnixEpoch.AddSeconds(LastCheckUpdateTime).ToLocalTime();
|
||||
var now = DateTime.Now;
|
||||
|
||||
if (lastCheck.Year == now.Year && lastCheck.Month == now.Month && lastCheck.Day == now.Day)
|
||||
return false;
|
||||
|
||||
LastCheckUpdateTime = now.Subtract(DateTime.UnixEpoch.ToLocalTime()).TotalSeconds;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddNode(RepositoryNode node, RepositoryNode to = null)
|
||||
{
|
||||
var collection = to == null ? _instance._repositoryNodes : to.SubNodes;
|
||||
|
|
Loading…
Reference in a new issue