New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change splash db upgrade logic #10731
Conversation
@Paxxi @DaveTBlake for review/test |
A welcome follow on from #10483 that only shows when migration tasks happening rather than every start up. @MilhouseVH, @tamland and @fritsch may be interested in this too. |
#. Localized addon database name for splash screen | ||
#: xbmc/addons/AddonDatabase.h | ||
msgctxt "#24152" | ||
msgid "Addon" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Thanks @phate89 - it works well, I've tested upgrading MyMusic50 to MyMusic60 and MyVideos90 to MyVideos107, the latter is particularly time consuming. I'll include this PR in future builds. There does however remain one issue: when IMHO the splash should be forced to appear along with the migration messages, regardless of the One other nitpick would be to position the text a little higher, just in case of any overscanning or weird resolution issues - it seems a little unnecessary to position the text quite so low down (it appears to be close to the bottom edge of my 1920x1080 1:1 pixel screen). |
+1 I too would put the text a little higher, and probably shouldn't capatalise "Database", e.g. |
I updated the pr.. Now we update the text adding dot every second.. |
Sorry but not liking how this is currently implemented. The database should not have a dependency on the global application messenger. Instead it should be passed in as a callback/another agnostic structure, or the entire migration refactored and uncoupled from the database. This is why I didn't bothered with it in the first place. |
Sleep(1000); | ||
} | ||
} | ||
Show(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@tamland trust that passing in a callback could be cleaner but more work. This is a step in the right direction and app messenger is purposely designed for this with very few dependencies itself. |
@tamland I added a new commit that moves the update part (the same update procedure, no refactor for now) to databasemanager. So only databasemanager has a dependency on applicationmessenger..Is it better? |
you could offload the migrations tasks to an extra thread. then the main thread can wait in init for this task to be completed and display splash and messages accordingly. |
@FernetMenta thanks for the suggestions. Any help is appreciated.
|
@phate89 yes, this will hold processing of the main thread until upgrade has finished. This is intended behaviour. |
95190fc
to
2beef54
Compare
@FernetMenta I updated the pr.. I moved the update logic to the db manager and moved the db upgrade and the addon migration to a separate thread (If I understood well our cthread) |
if (CDatabaseManager::GetInstance().IsRunning()) | ||
Sleep(1000); | ||
} | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Not exactly thread safe.. Try creating a task and send it off with CJobManager::Submit instead, or spawn a new thread; don't inherit from Cthread. Things like CAddonSystemSettings shouldn't be a thread. |
Thanks from the tip.. it'' quite nice ttt see we already have so many classes ready for several tasks.. I''l look into CJobManager and report back |
@tamland @FernetMenta I updated the pr using CJobManager::Submit. I hope I got it right this time :| |
{ | ||
if (CDatabaseManager::GetInstance().m_bIsUpgrading) | ||
CSplash::GetInstance().Show(std::string(i, ' ') + localizedStr + std::string(i, '.')); | ||
if (notFinished) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
{ | ||
for (int i = 1; i <= 3 && notFinished; ++i) | ||
{ | ||
if (CDatabaseManager::GetInstance().m_bIsUpgrading) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Looks ok from my pov. I can't say much about the upgrade itself |
jenkins build this please |
f9e72b7
to
438e7fc
Compare
Getting closer:) but you need to use std::future or events, and wait. With the sleeps the migration is up to 1 second slower than it need to be. |
@@ -141,13 +141,15 @@ std::vector<std::string> CAddonSystemSettings::MigrateAddons(std::function<void( | |||
|
|||
if (CSettings::GetInstance().GetInt(CSettings::SETTING_ADDONS_AUTOUPDATES) == AUTO_UPDATES_ON) | |||
{ | |||
onMigrate(); | |||
m_bIsMigratingAddons = true; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@tamland |
That's what it does. If you pass 1 second to the wait method it returns |
@tamland I'm dumb of course you're right.. i updated it using our CEvent class |
@@ -1123,8 +1124,22 @@ bool CApplication::Initialize() | |||
g_curlInterface.Unload(); | |||
|
|||
// initialize (and update as needed) our databases | |||
CSplash::GetInstance().Show(g_localizeStrings.Get(24150)); | |||
CDatabaseManager::GetInstance().Initialize(); | |||
CEvent event; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
now it should be ok.. thanks @FernetMenta @tamland for all the help.. |
win32 upgrade from v14 and all is fine. thx |
@FernetMenta @tamland if all good please merge :) |
fine by me, @tamland your button |
Change the splash screen to show the message of upgrading database only when we're actually upgrading a database.
Description
Motivation and Context
The old method wassn't aware if there was some upgrade and what db was doing the upgrade
How Has This Been Tested?
Tested upgrading my old mysql databases
Screenshots (if appropriate):
Types of change
Checklist: