DBus Runner: Add service property to request actions once
ClosedPublic

Authored by alex on Apr 25 2020, 11:33 AM.

Details

Summary

With the X-Plasma-Request-Actions-Once property the plugin
can specify if the actions should only be requested when the plugin is initialized.

This is useful if the plugin always used the same actions, because
then the we don't need to make the dbus calls for every match session.

Test Plan

Create dbus runner and don't set the extra property, the actions should be requested for each session.
(More like each query because of BUG: 420311).
After setting the property to true the actions should only be requested when the runner is initialized.

Diff Detail

Repository
R308 KRunner
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
alex created this revision.Apr 25 2020, 11:33 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 25 2020, 11:33 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
alex requested review of this revision.Apr 25 2020, 11:33 AM
meven added a comment.Apr 26 2020, 1:29 PM

Is it a dependency or alternative to D29050 ?

alex added a comment.Apr 26 2020, 1:34 PM

No, they are independent.
I just mentioned this to avoid confusion when debugging.

meven accepted this revision.Apr 30 2020, 6:08 AM

Seems good to me.
Before merging, maybe you could make a diff with a few runners in plasma-workspace use it.
And if you could add a test.

This revision is now accepted and ready to land.Apr 30 2020, 6:08 AM
alex updated this revision to Diff 81623.Apr 30 2020, 7:11 PM

Create test

ngraham accepted this revision.May 1 2020, 3:08 PM
This revision was automatically updated to reflect the committed changes.
meven added inline comments.May 1 2020, 4:56 PM
autotests/dbusrunnertest.cpp
204

typo: already

206

You should have added a QSignalSpy to check prepare was called, and another for requestAction to check it has been called only once.

alex added inline comments.May 2 2020, 5:23 PM
autotests/dbusrunnertest.cpp
206

The concept behind this test is, that the runner is just loaded. If the Request-Actions-Once property is correctly implemented the actions are requested when the plugin is initialized. That means that they should be available and prepare doesn't need to be called.

So it would make sense to add a signal spy to check if prepare was not called at all, or am I missing something?

meven added inline comments.May 7 2020, 12:12 PM
autotests/dbusrunnertest.cpp
206

I am not sure the test illustrates the change.
1 action available means it did not regress but you don't test the actual new behavior AFAICT

Only by adding signals spies can you test the actual behavior here.

I would trigger a second match and check requestActions was only called once, but prepare called each time as usual.