BUG-2529: This should most likely fix the excessive update checks, with a loss of potential good checks.

This commit is contained in:
Robin Krom 2020-02-10 22:57:15 +01:00
commit b21c114c1f

View file

@ -1,20 +1,20 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or * the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -78,8 +78,13 @@ namespace Greenshot.Experimental {
Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version; Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version;
// Test like this: // Test like this:
// currentVersion = new Version("0.8.1.1198"); // currentVersion = new Version("0.8.1.1198");
try { // Make sure we update the LastUpdateCheck, in case an error occurs we should not retry every 5 minutes
// This actually prevents an update check, but rather one to less than many to many
CoreConfig.LastUpdateCheck = DateTime.Now;
try
{
_latestGreenshot = null; _latestGreenshot = null;
ProcessRssInfo(currentVersion); ProcessRssInfo(currentVersion);
if (_latestGreenshot != null) { if (_latestGreenshot != null) {
@ -87,7 +92,6 @@ namespace Greenshot.Experimental {
MainForm.Instance.NotifyIcon.BalloonTipClosed += CleanupBalloonTipClick; MainForm.Instance.NotifyIcon.BalloonTipClosed += CleanupBalloonTipClick;
MainForm.Instance.NotifyIcon.ShowBalloonTip(10000, "Greenshot", Language.GetFormattedString(LangKey.update_found, "'" + _latestGreenshot.File + "'"), ToolTipIcon.Info); MainForm.Instance.NotifyIcon.ShowBalloonTip(10000, "Greenshot", Language.GetFormattedString(LangKey.update_found, "'" + _latestGreenshot.File + "'"), ToolTipIcon.Info);
} }
CoreConfig.LastUpdateCheck = DateTime.Now;
} catch (Exception e) { } catch (Exception e) {
Log.Error("An error occured while checking for updates, the error will be ignored: ", e); Log.Error("An error occured while checking for updates, the error will be ignored: ", e);
} }
@ -98,7 +102,7 @@ namespace Greenshot.Experimental {
MainForm.Instance.NotifyIcon.BalloonTipClicked -= HandleBalloonTipClick; MainForm.Instance.NotifyIcon.BalloonTipClicked -= HandleBalloonTipClick;
MainForm.Instance.NotifyIcon.BalloonTipClosed -= CleanupBalloonTipClick; MainForm.Instance.NotifyIcon.BalloonTipClosed -= CleanupBalloonTipClick;
} }
private static void HandleBalloonTipClick(object sender, EventArgs e) { private static void HandleBalloonTipClick(object sender, EventArgs e) {
try { try {
if (_latestGreenshot != null) { if (_latestGreenshot != null) {