* profiles/common, bin/updates-available: the updates-available script now

caches its value, expiring that value every 60 minutes; so subsequent
    checks are much cheaper;  we can allow the screen status script to run
    more frequently now, since most will be cache checks; we'll really benefit
    from this in Jaunty
This commit is contained in:
Dustin Kirkland 2009-01-15 14:55:26 -06:00
commit 4c77400f87
3 changed files with 11 additions and 3 deletions

View file

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
# expire the cache in X seconds; 1 hour by default
EXPIRATION=3600
print_updates() { print_updates() {
u=$1 u=$1
if [ "$u" = "0" ]; then if [ "$u" = "0" ]; then
@ -26,7 +29,7 @@ if [ -r $mycache -a -O $mycache ]; then
now=`date +%s` now=`date +%s`
timestamp=`stat -c "%Y" $mycache` timestamp=`stat -c "%Y" $mycache`
diff=`expr $now - $timestamp` diff=`expr $now - $timestamp`
if [ $diff -lt 3600 ]; then if [ $diff -lt $EXPIRATION ]; then
u=`grep -m 1 "^[0-9]" $mycache | sed "s/\s.*$//"` u=`grep -m 1 "^[0-9]" $mycache | sed "s/\s.*$//"`
print_updates $u print_updates $u
fi fi

7
debian/changelog vendored
View file

@ -6,8 +6,13 @@ screen-profiles (1.9) UNRELEASED; urgency=low
[ Dustin Kirkland ] [ Dustin Kirkland ]
* keybindings/common: fix leading whitespace on new window creation * keybindings/common: fix leading whitespace on new window creation
LP: #317558 LP: #317558
* profiles/common, bin/updates-available: the updates-available script now
caches its value, expiring that value every 60 minutes; so subsequent
checks are much cheaper; we can allow the screen status script to run
more frequently now, since most will be cache checks; we'll really benefit
from this in Jaunty
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 15 Jan 2009 10:50:50 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Thu, 15 Jan 2009 14:53:16 -0600
screen-profiles (1.8-0ubuntu1) jaunty; urgency=low screen-profiles (1.8-0ubuntu1) jaunty; urgency=low

View file

@ -30,7 +30,7 @@ msgwait 1
# Define status commands # Define status commands
backtick 100 3600 3600 /usr/share/screen-profiles/bin/release backtick 100 3600 3600 /usr/share/screen-profiles/bin/release
backtick 101 3600 3600 /usr/share/screen-profiles/bin/updates-available backtick 101 60 60 /usr/share/screen-profiles/bin/updates-available
backtick 102 10 10 /usr/share/screen-profiles/bin/reboot-required backtick 102 10 10 /usr/share/screen-profiles/bin/reboot-required
backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq
backtick 104 3600 3600 /usr/share/screen-profiles/bin/cpu-count backtick 104 3600 3600 /usr/share/screen-profiles/bin/cpu-count