Esempio n. 1
0
		public static void FinalizeHub(string id)
		{
			if (Utils.IsRegion(id))
				throw new Exception(String.Format("FinalizeHub called erroneously for {0}", id));

			GenUtils.LogMsg("status", "worker finalizing hub: " + id, null);

			Utils.UpdateFeedCountForId(id);

			var calinfo = Utils.AcquireCalinfo(id);

			EventStore.CombineZonedEventStoresToZonelessEventStore(id, settings); 

			// Create or update an entry in the cacheurls table for the base object. 
			// key is http://elmcity.blob.core.windows.net/ID/ID.zoneless.obj
			// value is # of webrole instances that could be holding this in cache
			// each instance will check this table periodically. if value is nonzero and url in cache, it'll evict the object
			// and decrement the count

			// note when removal occurs it also triggers a purge of dependencies, so if the base entry is
			// http://elmcity.blob.core.windows.net/a2cal/a2cal.zoneless.obj
			// then dependencies also ousted from cache include:
			// /services/a2cal/html?view=&count=0
			// /services/a2cal/rss?view=government
			// /services/a2cal/xml?view=music&count=10    ... etc.

			CacheUtils.MarkBaseCacheEntryForRemoval(Utils.MakeBaseZonelessUrl(id), Convert.ToInt32(settings["webrole_instance_count"]));

			RenderTags(id);  // static renderings, mainly for debugging now that GetEvents uses dynamic rendering

			var fr = new FeedRegistry(id);
			fr.LoadFeedsFromAzure(FeedLoadOption.all);

			if (calinfo.hub_enum == HubType.where)
			{
				SaveWhereStats(fr, calinfo);
				Utils.SaveMeetupLocations(calinfo, settings);
			}

			if (calinfo.hub_enum == CalendarAggregator.HubType.what)
				SaveWhatStats(fr, calinfo);

			//if (!Utils.IsRegion(id))
			//	MergeIcs(calinfo);
			// else  
			// todo: create MergeRegionIcs

			Utils.VisualizeTagSources(id);

			ImageSelection.BuildCategoryImagesForHub(id);

			GenUtils.LogMsg("status", "worker done finalizing hub " + id, null);
		}
Esempio n. 2
0
		public static void DoIcal(FeedRegistry fr, Calinfo calinfo)
		{
			if (testfeeds.Count > 0)
				foreach (var testfeed in testfeeds)
					fr.AddFeed(testfeed, "testing: " + testfeed);
			else
				fr.LoadFeedsFromAzure(FeedLoadOption.all);

			var id = calinfo.id;

			ZonedEventStore ical = new ZonedEventStore(calinfo, SourceType.ical);
			try
			{

				GenUtils.LogMsg("status", "DoIcal: " + id, null);
				Collector coll = new Collector(calinfo, settings);
				coll.CollectIcal(fr, ical, test: testing);
			}
			catch (Exception e)
			{
				GenUtils.LogMsg("exception", "DoIcal: " + id, e.Message + e.StackTrace);
			}
		}