Friday, November 19, 2010 at 3:00 AM.

river2Suite.doScanNow

on doScanNow () {
	<<Changes
		<<11/17/10; 1:09:56 PM by DW
			<<Instead of building the static pages here directly, set a boolean that causes them to be built in the everyMinute script. This keeps the builds from piling up if there are lots of updates.
		<<11/17/10; 12:02:50 PM by DW
			<<If a call to river2Suite.readList fails, that shouldn't kill the scan. We now log the error and continue the scan.
		<<10/6/10; 8:54:09 PM by DW
			<<Use river2Suite.readAllFeeds to do the scan.
		<<9/26/10; 10:49:42 AM by DW
			<<Call the beforeScan callbacks.
		<<3/17/10; 8:21:11 PM by DW
			<<Do a static render after completing scan, if enabled.
		<<9/17/09; 7:27:27 AM by DW
			<<Update opml.root after every scan as well as river2.root.
		<<8/16/09; 12:00:15 PM by DW
			<<Read the reading lists before the feeds.
		<<8/10/09; 2:45:34 PM by DW
			<<Do a code update after running a scan.
		<<8/10/09; 7:32:01 AM by DW
			<<Minor tweak to the log message.
		<<7/18/09; 5:09:26 PM by DW
			<<Renew subscriptions after every scan. If a feed gets a <cloud> element, we respond as soon as we notice it.
		<<6/16/09; 1:58:00 PM by DW
			<<Created. 
	local (adrdata = river2suite.init (), adrfeed, startticks = clock.ticks ());
	bundle { //callbacks, 9/26/10 by DW
		local (adrscript);
		for adrscript in @adrdata^.callbacks.beforeScan {
			while typeof (adrscript^) == addresstype {
				adrscript = adrscript^};
			try {adrscript^ ()}}};
	local (ctItemsAtStart = adrdata^.stats.ctItems, ctfeeds=0);
	river2Suite.opmlAutoExport (); //if enabled, export before every scan
	adrdata^.stats.whenLastScanStart = clock.now ();
	bundle { //read all the lists 
		local (adrlist);
		for adrlist in @adrdata^.lists {
			local (url = nameof (adrlist^), startticks = clock.ticks ());
			try {
				river2Suite.readList (url)}
			else {
				log2.add (river2Info.name, "Error", "Error in <a href=\"" + url + "\">readling list</a>: \"" + tryerror + "\"", startticks)}}};
	bundle { //read all the feeds
		<<for adrfeed in @adrdata^.feeds
			<<river2Suite.readFeed (nameof (adrfeed^))
			<<ctfeeds++
		river2suite.readallfeeds (@ctfeeds)}; //10/6/10 by DW
	river2Suite.renewSubscriptions (); //7/18/09 by DW
	adrdata^.stats.whenLastScanEnd = clock.now ();
	adrdata^.stats.ctScans++;
	bundle { //log the scan
		local (ctnewitems = adrdata^.stats.ctItems - ctItemsAtStart);
		local (htmltext = ctfeeds + " feeds read, " + ctnewitems + " new items.");
		log2.add (river2Info.name, "Scan", htmltext, startticks)};
	bundle { //static render if enabled, 3/17/10 by DW
		if adrdata^.prefs.static.enabled {
			<<thread.callscript (@river2Suite.static.afterScan, {})
			system.temp.river2.flStaticBuild = true}}; //11/17/10 by DW
	bundle { //callbacks
		local (adrscript);
		for adrscript in @adrdata^.callbacks.afterScan {
			while typeof (adrscript^) == addresstype {
				adrscript = adrscript^};
			try {adrscript^ ()}}};
	bundle { //code update, 8/10/09 by DW
		frontier.tools.updateme (this);
		opmlEditor.updateMainRoot ()}}; //9/17/09 by DW
bundle { //test code
	doScanNow ()}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.