[89892] trunk/base/src/macports1.0/macports.tcl
jmr at macports.org
jmr at macports.org
Mon Feb 13 21:17:50 PST 2012
Revision: 89892
http://trac.macports.org/changeset/89892
Author: jmr at macports.org
Date: 2012-02-13 21:17:50 -0800 (Mon, 13 Feb 2012)
Log Message:
-----------
make sure stale ping cache entries are removed even if they're not accessed
Modified Paths:
--------------
trunk/base/src/macports1.0/macports.tcl
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2012-02-14 05:17:39 UTC (rev 89891)
+++ trunk/base/src/macports1.0/macports.tcl 2012-02-14 05:17:50 UTC (rev 89892)
@@ -1046,10 +1046,18 @@
proc mportshutdown {} {
# save ping times
global macports::ping_cache macports::portdbpath
- catch {
- set pingfile [open ${macports::portdbpath}/pingtimes w]
- puts $pingfile [array get macports::ping_cache]
- close $pingfile
+ if {[file writable ${macports::portdbpath}]} {
+ catch {
+ foreach host [array names ping_cache] {
+ # don't save expired entries
+ if {[expr [clock seconds] - [lindex $ping_cache($host) 1]] < 86400} {
+ lappend pinglist_fresh $host $ping_cache($host)
+ }
+ }
+ set pingfile [open ${macports::portdbpath}/pingtimes w]
+ puts $pingfile $pinglist_fresh
+ close $pingfile
+ }
}
# close it down so the cleanup stuff is called, e.g. vacuuming the db
registry::close
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120213/2496465f/attachment-0001.html>
More information about the macports-changes
mailing list