From 4c77400f87c92ca04de8864db1d0359577114b20 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 15 Jan 2009 14:55:26 -0600 Subject: [PATCH] * 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 --- bin/updates-available | 5 ++++- debian/changelog | 7 ++++++- profiles/common | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/updates-available b/bin/updates-available index 635a0219..1b67fff2 100755 --- a/bin/updates-available +++ b/bin/updates-available @@ -1,5 +1,8 @@ #!/bin/sh +# expire the cache in X seconds; 1 hour by default +EXPIRATION=3600 + print_updates() { u=$1 if [ "$u" = "0" ]; then @@ -26,7 +29,7 @@ if [ -r $mycache -a -O $mycache ]; then now=`date +%s` timestamp=`stat -c "%Y" $mycache` diff=`expr $now - $timestamp` - if [ $diff -lt 3600 ]; then + if [ $diff -lt $EXPIRATION ]; then u=`grep -m 1 "^[0-9]" $mycache | sed "s/\s.*$//"` print_updates $u fi diff --git a/debian/changelog b/debian/changelog index fd00d2ad..0c87ecc9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,13 @@ screen-profiles (1.9) UNRELEASED; urgency=low [ Dustin Kirkland ] * keybindings/common: fix leading whitespace on new window creation 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 Thu, 15 Jan 2009 10:50:50 -0600 + -- Dustin Kirkland Thu, 15 Jan 2009 14:53:16 -0600 screen-profiles (1.8-0ubuntu1) jaunty; urgency=low diff --git a/profiles/common b/profiles/common index d74fa7a0..ba6468f4 100644 --- a/profiles/common +++ b/profiles/common @@ -30,7 +30,7 @@ msgwait 1 # Define status commands 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 103 5 5 /usr/share/screen-profiles/bin/cpu-freq backtick 104 3600 3600 /usr/share/screen-profiles/bin/cpu-count