Bug 29992

Summary: signaling applications at different intervals
Product: GeoClue Reporter: Stefan Kost <ensonic>
Component: GeneralAssignee: Geoclue Bugs <geoclue-bugs>
Status: RESOLVED WONTFIX QA Contact: Geoclue Bugs <geoclue-bugs>
Severity: enhancement    
Priority: medium CC: martvirt, wolf+meego
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Stefan Kost 2010-09-03 01:55:24 UTC
As far as I see the dbus signals for position/velocity/address_changed would wake up all clients subscribed here. For mobile devices it would be nice to have means for client to specify how often they need updates. Like client A wants updates every second and client B only once ever 5 minutes.

A bit of code for rate-limiting is implemented already and there is bug #29974 to optimize that on the backend side.

This bug can be closed if someone can confirm, that each client would actually have a separate instance on the geoclue side that would apply the constraints set via geoclue_master_client_set_requirements() and thus do the rate-limiting per client. Bonus points for adding a note to the docs to clarify this :).
Comment 1 Wolf Bergenheim 2010-09-06 11:02:43 UTC
Well this could be resolved in two different ways:

1) The master server could keep track of all of its subscribers and call a well known method on the subscribed clients when the timer for that client has expired. The handling of this method would be take care of by a client library.

2) The client end could filter to only get signals with a specific parameter set. So when you subscribe you would get as a reply an id which would be given in the signal, so you can filter on it. This would be done by some client library for you, so you wouldn't have to worry about the specifics.
Comment 2 Martti Virtanen 2010-09-16 06:50:52 UTC
@Wolf: Yes, option 1 sounds like the correct way. In option 2 every application must wake up for every update to check this specific parameter, and that is exactly what is bug is about.
Comment 3 Ross Burton 2010-09-17 01:53:07 UTC
We agree that (2) is bad.  (1) would mean that instead of one signal being send to the bus daemon and the bus daemon sending it to all registered listeners we have to send N messages to each listener.  While this would involve less wakeups, we're massively increasing the amount of traffic on the bus.

Personally I don't think per-application rate limiting is that useful.  If every app on the device that wants position updates only wants a position every minute, then we should send the signals every minute.  If there is one that wants updates every second then we're already waking the CPU up, so will the extra notifications really be noticeable when compared with the extra workload that the alternatives imply?
Comment 4 Juha Vuolle 2010-10-06 19:17:51 UTC
I'm not sure if sending a signal per client would really flood the bus. Consider if there are three apps, one app needing every second, second app needing every minute, third one every five minutes. Over five minutes period of time, this would result in 306 messages (300 for the first app, five for the second, and 1 for the third), of which 6 are now extra. I think its fairly small percentage considering that 600 application wakeups/process switches are avoided (the "minute" applications don't need to wake up to see if their timer is running).

That is unless I've misunderstood how the dbus here works :)

On another (side)note, I have a feeling that many applications don't need updates exactly at the interval they requested. But rather they could specify range/accuracy for their updates which potentially could enable ways of grouping the signals better.  Perhaps a bit high flying thought for the bug at hand though...
Comment 5 Zeeshan Ali 2013-09-09 14:50:14 UTC
Closing all bugs on old geoclue. If your bug still applies to new geoclue, please do re-open, I really don't have time to go through each and every bug and evaluate separately. :( Apologies for any inconvenience caused by this change.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.