Check-in [cc5a68a6de]
Overview
Comment:Fixed cleanup issue which was causing excessive lookups
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cc5a68a6de7966b5867eb39d03bb2fbd8be695c5
User & Date: rkeene on 2014-11-05 21:41:57
Other Links: manifest | tags
Context
2014-11-06
02:49
Updated to indicate only that packaged files are writable check-in: 97e72202db user: rkeene tags: trunk
00:37
Merged in updates from trunk check-in: ee9eb7ed98 user: rkeene tags: internal_sha1
2014-11-05
21:41
Fixed cleanup issue which was causing excessive lookups check-in: cc5a68a6de user: rkeene tags: trunk
21:41
Added "package" command back, needed for older versions of "http" package check-in: b1167b6699 user: rkeene tags: trunk
Changes

Modified appfsd.tcl from [e521e020ce] to [86cb2b92c8].

151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
	}

	proc download {hostname hash {method sha1}} {
		set url "http://$hostname/appfs/$method/$hash"
		set file [_cachefile $url $hash]

		if {![file exists $file]} {
			return -code error "Unable to fetch"
		}

		return $file
	}

	proc getindex {hostname} {
		set now [clock seconds]







|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
	}

	proc download {hostname hash {method sha1}} {
		set url "http://$hostname/appfs/$method/$hash"
		set file [_cachefile $url $hash]

		if {![file exists $file]} {
			return -code error "Unable to fetch (file does not exist: $file)"
		}

		return $file
	}

	proc getindex {hostname} {
		set now [clock seconds]
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199

		catch {
			set token [::http::geturl $url]
			if {[::http::ncode $token] == "200"} {
				set indexhash_data [::http::data $token]
			}
			::http::reset $token
			$token cleanup
		}

		if {![info exists indexhash_data]} {
			# Cache this result for 60 seconds
			_db eval {INSERT OR REPLACE INTO sites (hostname, lastUpdate, ttl) VALUES ($hostname, $now, $::appfs::nttl);}

			return -code error "Unable to fetch $url"







|







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199

		catch {
			set token [::http::geturl $url]
			if {[::http::ncode $token] == "200"} {
				set indexhash_data [::http::data $token]
			}
			::http::reset $token
			::http::cleanup $token
		}

		if {![info exists indexhash_data]} {
			# Cache this result for 60 seconds
			_db eval {INSERT OR REPLACE INTO sites (hostname, lastUpdate, ttl) VALUES ($hostname, $now, $::appfs::nttl);}

			return -code error "Unable to fetch $url"