BucketCountingCrawler: store just the count, not cycle+count, since it's too easy to make usage mistakes otherwise

This commit is contained in:
Brian Warner 2009-02-20 21:58:31 -07:00
parent 3c6471c717
commit 106d31b112
3 changed files with 4 additions and 6 deletions

View File

@ -373,7 +373,7 @@ class BucketCountingCrawler(ShareCrawler):
if len(last_counts) == len(self.prefixes):
# great, we have a whole cycle.
num_buckets = sum(last_counts.values())
self.state["last-complete-bucket-count"] = (cycle, num_buckets)
self.state["last-complete-bucket-count"] = num_buckets
# get rid of old counts
for old_cycle in list(self.state["bucket-counts"].keys()):
if old_cycle != cycle:

View File

@ -173,8 +173,7 @@ class StorageServer(service.MultiService, Referenceable):
s = self.bucket_counter.get_state()
bucket_count = s.get("last-complete-bucket-count")
if bucket_count:
cycle, count = bucket_count
stats["storage_server.total_bucket_count"] = count
stats["storage_server.total_bucket_count"] = bucket_count
return stats

View File

@ -65,10 +65,9 @@ class StorageStatus(rend.Page):
def data_last_complete_bucket_count(self, ctx, data):
s = self.storage.bucket_counter.get_state()
lcbc = s.get("last-complete-bucket-count")
if lcbc is None:
count = s.get("last-complete-bucket-count")
if count is None:
return "Not computed yet"
cycle, count = lcbc
return count
def render_count_crawler_status(self, ctx, storage):