Closed
Bug 476253
Opened 16 years ago
Closed 16 years ago
Dynamically pick next polling time for IdleService (instead of polling every 5 sec)
Categories
(Core :: Widget, defect)
Core
Widget
Tracking
()
RESOLVED
FIXED
mozilla1.9.2a1
People
(Reporter: Mardak, Assigned: Mardak)
References
Details
(Keywords: fixed1.9.1)
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
Details | Diff | Splinter Review |
We can save on unnecessary polls by looking at the expected next here->idle transition time instead of blindly polling every 5 seconds.
(FYI, I'm interested in having the nsIIdleService send an observerService notification, once-a-day-on-idle, which will send that notification when the user goes idle, but will send at most one of these in a 24 hour period. This will require a timer to be available all the time, so I figured it would be good to make the polling "interval" smarter.)
Assignee | ||
Comment 1•16 years ago
|
||
Keep the minimum polling time at 5 seconds, but if we don't need to poll frequently, just check once every 5 minutes. (Actually we would only really need to check when the next here->idle transition might occur, but this is in preparation for an always-around timer for the once-a-day-on-idle notification.)
Also store the required idle time in milliseconds to not need to calculate * 1000 every time we check away state.
Comment on attachment 359887 [details] [diff] [review]
v1
- {
mTimer->Cancel();
- mTimer = nsnull;
- }
Please don't remove the {} around single statements. That's our coding style last I checked.
Attachment #359887 -
Flags: superreview+
Attachment #359887 -
Flags: review?(roc)
Attachment #359887 -
Flags: review+
Comment 3•16 years ago
|
||
This is going to suck for IM and such applications, where the idle time is actually directly reflected by automatic UI changes or server interaction. I mean, I wouldn't want my instant messaging program to wait 5 minutes before realizing I was back at the machine. :-\
So I'm not sure this is the right thing to do. I realize I don't have a say in this, but I'm a bit confused what your arguments are as to why this is even possible (rather than why it'd be a perf improvement - obviously we could get an even bigger perf improvement if we only polled once a day, but obviously that would also defeat the point).
Assignee | ||
Comment 4•16 years ago
|
||
When expecting an idle->back transition, it'll poll at the current 5 seconds. Only if all listeners are waiting for back->idle transition will it poll at 5 minute intervals (or somewhere between 5sec and 5min, e.g., 3 minutes if the next idle listener is looking for idle in 3 more minutes.)
Comment 5•16 years ago
|
||
(In reply to comment #4)
> When expecting an idle->back transition, it'll poll at the current 5 seconds.
> Only if all listeners are waiting for back->idle transition will it poll at 5
> minute intervals (or somewhere between 5sec and 5min, e.g., 3 minutes if the
> next idle listener is looking for idle in 3 more minutes.)
Ah, sorry, that's me not reading the patch (I just woke up). Apologies, and yes, that sounds fine, thanks!
Assignee | ||
Comment 6•16 years ago
|
||
(In reply to comment #2)
> Please don't remove the {} around single statements.
Restored the {}s and added them to the new code.
Attachment #359887 -
Attachment is obsolete: true
Assignee | ||
Comment 7•16 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Assignee | ||
Comment 8•16 years ago
|
||
Keywords: fixed1.9.1
You need to log in
before you can comment on or make changes to this bug.
Description
•