Janto Dreijer avatar Janto Dreijer committed 731d020

hacks to reduce update frequency

Comments (0)

Files changed (3)

 cron:
 - description: worker thread
   url: /worker?name=cronjob
-  schedule: every 30 minutes
+  schedule: every 120 minutes
 
 			news_items, _checked_urls = package.release_files(return_checked_urls=True)
 			checked_urls.extend(_checked_urls)
 
-		# force a fetch of one of the http listings
-		t = time.time()
-		key = "next_listing_url_index"
-		n = memcache.get(key)
-		if n is None:
-			n = 0
-		memcache.set(key, (n+1) % len(checked_urls)) # set the next url to be fetched
-		url = checked_urls[n]
-		report = "forcing fetch of url: %s (n=%d/%d)" % (url, n, len(checked_urls))
-		self.logger.info(report)
-		self.write("<li>"+report)
-		get_url(url, force_fetch=True, cache_duration=PACKAGE_NEWS_CACHE_DURATION)
-		report = "<li>fetched url in %0.2f seconds" % (time.time() - t)
-		self.logger.info(report)
-		self.write(report)
+		if random.random() < 0.3:
+
+			# force a fetch of one of the http listings
+			t = time.time()
+			key = "next_listing_url_index"
+			n = memcache.get(key)
+			if n is None:
+				n = 0
+			memcache.set(key, (n+1) % len(checked_urls)) # set the next url to be fetched
+			url = checked_urls[n]
+			report = "forcing fetch of url: %s (n=%d/%d)" % (url, n, len(checked_urls))
+			self.logger.info(report)
+			self.write("<li>%s</li>"%report)
+			get_url(url, force_fetch=True, cache_duration=PACKAGE_NEWS_CACHE_DURATION)
+			report = "<li>fetched url in %0.2f seconds</li>" % (time.time() - t)
+			self.logger.info(report)
+			self.write(report)
+
+		else:
+			report = "not fetching http listing"
+			self.logger.info(report)
+			self.write(report)
 
 class MainPage(Page):
 
 SECONDS_IN_MONTH = SECONDS_IN_DAY * 28
 
 # how often new data needs to be loaded
-PACKAGE_INFO_CACHE_DURATION = SECONDS_IN_HOUR * 3
-PACKAGE_NEWS_CACHE_DURATION = SECONDS_IN_DAY * 3
-PACKAGE_LISTING_CACHE_DURATION = SECONDS_IN_HOUR * 3
+PACKAGE_INFO_CACHE_DURATION = SECONDS_IN_HOUR * 6
+PACKAGE_NEWS_CACHE_DURATION = SECONDS_IN_DAY * 6
+PACKAGE_LISTING_CACHE_DURATION = SECONDS_IN_HOUR * 6
 
 import time
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.