@@ -178,15 +178,34 @@ void Updater::checkUpdatesOnStart()
178178
179179 mDailyCheck ->setInterval (12h);
180180 connect (mDailyCheck .get (), &QTimer::timeout, this , [this ] {
181- auto updates = feed->getUpdates (dblsqd::Release::getCurrentRelease ());
182- qWarning () << " Bi-daily check for updates:" << updates.size () << " update(s) available" ;
183- if (updates.isEmpty ()) {
184- return ;
185- } else if (!updateAutomatically ()) {
186- emit signal_updateAvailable (updates.size ());
187- } else {
188- feed->downloadRelease (updates.first ());
189- }
181+ // Reload the feed to get fresh data before checking for updates
182+ // Use single-shot connections to avoid multiple handlers accumulating
183+ KDToolBox::connectSingleShot (feed, &dblsqd::Feed::ready, this , [this ]() {
184+ auto updates = feed->getUpdates (dblsqd::Release::getCurrentRelease ());
185+ qWarning () << " Bi-daily check for updates:" << updates.size () << " update(s) available" ;
186+ if (updates.isEmpty ()) {
187+ return ;
188+ }
189+
190+ if (!updateAutomatically ()) {
191+ emit signal_updateAvailable (updates.size ());
192+ return ;
193+ }
194+
195+ // Validate the release has a valid download URL before attempting download
196+ const auto & release = updates.first ();
197+ const QUrl downloadUrl = release.getDownloadUrl ();
198+ if (!downloadUrl.isValid () || downloadUrl.isEmpty ()) {
199+ qWarning () << " Bi-daily update check: invalid download URL for release" << release.getVersion ();
200+ return ;
201+ }
202+
203+ feed->downloadRelease (release);
204+ });
205+ KDToolBox::connectSingleShot (feed, &dblsqd::Feed::loadError, this , [](const QString& error) {
206+ qWarning () << " Bi-daily update check: failed to load feed:" << error;
207+ });
208+ feed->load ();
190209 });
191210 mDailyCheck ->start ();
192211}
0 commit comments