mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -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,9 +227,12 @@ namespace SourceGit
|
||||||
_notificationReceiver = launcher;
|
_notificationReceiver = launcher;
|
||||||
desktop.MainWindow = launcher;
|
desktop.MainWindow = launcher;
|
||||||
|
|
||||||
if (ViewModels.Preference.Instance.Check4UpdatesOnStartup)
|
if (ViewModels.Preference.Instance.ShouldCheck4UpdateOnStartup)
|
||||||
|
{
|
||||||
|
ViewModels.Preference.Save();
|
||||||
Check4Update();
|
Check4Update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
base.OnFrameworkInitializationCompleted();
|
base.OnFrameworkInitializationCompleted();
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,6 +278,31 @@ namespace SourceGit.ViewModels
|
||||||
set;
|
set;
|
||||||
} = 0;
|
} = 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)
|
public static void AddNode(RepositoryNode node, RepositoryNode to = null)
|
||||||
{
|
{
|
||||||
var collection = to == null ? _instance._repositoryNodes : to.SubNodes;
|
var collection = to == null ? _instance._repositoryNodes : to.SubNodes;
|
||||||
|
|
Loading…
Reference in a new issue