Skip to content
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

Throttle RSS unread signal handling in MainWindow #16377

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jagannatharjun
Copy link
Member

Improves startup time

{
m_rssUnreadUpdateEnqueued = false;

if (!m_rssWidget)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use m_rssWidget as a context to avoid this check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_rssWidget is a QPointer, so I thought it's not owned by this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean QTimer::singleShot(100, m_rssWidget, [this]() so connection will be destroyed when m_rssWidget is destroyed and you don't need check it inside lambda body.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if this is destroyed but m_rssWidget not

m_rssWidget is a QPointer, so I thought it's not owned by this.

checking a QPointer before it's use is recommended.
I didn't look into who owns m_rssWidget

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MainWindow owns (should own) all child widgets "by design". QPointers are just misused in legacy code. However, since we've stumbled upon this problem and you're bumping into it, you can wait for me or someone else to fix it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can wait for me or someone else to fix it.

extra code can be removed later on when someone will fix this problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra code can be removed later on when someone will fix this problem.

Extra code can be removed now since fixing the problem doesn't really affect it. As I said above MainWindow owns child widgets so it is destroyed after them.

@glassez glassez added the GUI GUI-related issues/changes label Feb 4, 2022
@glassez glassez added this to the 4.5.0 milestone Feb 4, 2022
@glassez glassez self-assigned this Feb 4, 2022
@@ -261,6 +261,8 @@ private slots:
SettingValue<bool> m_storeNotificationTorrentAdded;
CachedSettingValue<Log::MsgTypes> m_storeExecutionLogTypes;

bool m_rssUnreadUpdateEnqueued = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please place it out of "Setting values" section.

@@ -681,9 +681,19 @@ void MainWindow::on_actionLock_triggered()
hide();
}

void MainWindow::handleRSSUnreadCountUpdated(int count)
void MainWindow::handleRSSUnreadCountUpdated(int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the parameter entirely.

@glassez
Copy link
Member

glassez commented Feb 5, 2022

If it really doesn't make sense to process all consecutive "unread count changed" events, then why not apply throttling at a lower level? Emitting signals (having connected slots) is also not cheap in itself.

@jagannatharjun
Copy link
Member Author

jagannatharjun commented Mar 10, 2022

If it really doesn't make sense to process all consecutive "unread count changed" events, then why not apply throttling at a lower level? Emitting signals (having connected slots) is also not cheap in itself.

It can be useful for other parts to get info in realtime.

This PR only affects tab texts update of MainWindow. Updating Tab texts are weirdly expensive. I'm planning to open similar PRs for other tabs in the main window.

@glassez
Copy link
Member

glassez commented Mar 10, 2022

This PR only affects tab texts update of MainWindow. Updating Tab texts are weirdly expensive. I'm planning to open similar PRs for other tabs in the main window.

Ok.
Please fix #16377 (comment) and #16377 (comment) to go further.

@glassez glassez modified the milestones: 4.5.0, 4.5.1 Nov 27, 2022
@@ -681,9 +681,19 @@ void MainWindow::on_actionLock_triggered()
hide();
}

void MainWindow::handleRSSUnreadCountUpdated(int count)
void MainWindow::handleRSSUnreadCountUpdated(int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void MainWindow::handleRSSUnreadCountUpdated(int)
void MainWindow::handleRSSUnreadCountUpdated()

@Pentaphon
Copy link

@jagannatharjun are you still around?

@sledgehammer999 sledgehammer999 modified the milestones: 4.5.1, 4.5.2 Feb 12, 2023
@sledgehammer999 sledgehammer999 modified the milestones: 4.5.2, 4.5.3 Feb 28, 2023
@sledgehammer999 sledgehammer999 modified the milestones: 4.5.3, 4.5.4 May 29, 2023
@sledgehammer999 sledgehammer999 modified the milestones: 4.5.4, 4.5.5 Jun 18, 2023
@glassez glassez removed this from the 4.5.5 milestone Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI GUI-related issues/changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants