BuildCategoryImagesForHub() public static méthode

public static BuildCategoryImagesForHub ( string id ) : void
id string
Résultat void
Exemple #1
0
 private static void BuildCategoriesForRegionSourcesForHubs(string region, string where)
 {
     ImageSelection.BuildCategoryImagesForHub(region);
     foreach (var id in Utils.GetIdsForRegion(region))
     {
         ImageSelection.BuildSourceImagesForHub(id);
     }
 }
Exemple #2
0
		public static void ProcessRegion(string region)
		{
			if ( ! Utils.IsRegion (region) )
				throw new Exception(String.Format("ProcessRegion called erroneously for {0}", region));

			GenUtils.LogMsg("status", "worker starting on region tasks for " + region, null);

			var calinfo = Utils.AcquireCalinfo(region);

			try
			{
				var es_region = new ZonelessEventStore(calinfo);

				var ids = Utils.GetIdsForRegion(region);

				Parallel.ForEach(source: ids, body: (id) =>
				{
					var uri = BlobStorage.MakeAzureBlobUri(id, id + ".zoneless.obj", false);
					var es = (ZonelessEventStore)BlobStorage.DeserializeObjectFromUri(uri);
					foreach (var evt in es.events)
					{
						evt.categories += "," + id.ToLower();  // so tag viewer can slice region by hub name
						lock (es_region)
						{
							es_region.events.Add(evt);
						}
					}
				}
				);

				Utils.UpdateFeedCountForId(region);

				ZonelessEventStore.Finalize(calinfo, es_region);

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

				RenderTags(region);

				Utils.TagsByHub(region, authorized: true);
				Utils.TagsByHub(region, authorized: false);

				SaveRegionStats(region);

				ImageSelection.BuildCategoryImagesForHub(region);

				Utils.SaveQuickStatsForRegion(region);
			}
			catch (Exception e)
			{
				var msg = "process region: " + region;
				var data = e.Message + e.StackTrace;
				GenUtils.PriorityLogMsg("exception", msg, data);
			}
			GenUtils.LogMsg("status", "worker done processing region " + region, null);
		}
Exemple #3
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);
		}