コード例 #1
0
			public void Add (string dir_name, string file_name, bool addition)
			{
				lock (queue_lock) {
					event_queue.Enqueue (new Event (dir_name, file_name, addition));

					if (self_task == null) {
						self_task = queryable.NewAddTask (this);
						self_task.Priority = Scheduler.Priority.Immediate;
						queryable.ThisScheduler.Add (self_task);
					}
				}
			}
コード例 #2
0
ファイル: LuceneQueryable.cs プロジェクト: zweib730/beagrep
		private void ScheduleOptimize ()
		{
			double optimize_delay;

			// Really we only want to optimize at most once a day, even if we have
			// indexed a ton of dat
			TimeSpan span = DateTime.Now - last_optimize_time;
			if (span.TotalDays > 1.0)
				optimize_delay = 10.0; // minutes;
			else
				optimize_delay = (new TimeSpan (TimeSpan.TicksPerDay) - span).TotalMinutes;

			if (our_optimize_task == null)
				our_optimize_task = NewOptimizeTask ();

			if (OptimizeRightAway || Environment.GetEnvironmentVariable ("BEAGREP_UNDER_BLUDGEON") != null)
				optimize_delay = 1/120.0; // half a second

			// Changing the trigger time of an already-scheduled process
			// does what you would expect.
			our_optimize_task.TriggerTime = DateTime.Now.AddMinutes (optimize_delay);

			// Adding the same task more than once is a harmless no-op.
			ThisScheduler.Add (our_optimize_task);
		}
コード例 #3
0
			public void PostFlushHook ()
			{
				lock (queue_lock) {
					if (event_queue.Count > 0)
						self_task.Reschedule = true;
					else
						self_task = null;
				}
			}
コード例 #4
0
ファイル: LuceneQueryable.cs プロジェクト: zweib730/beagrep
		private void ScheduleFinalFlush ()
		{
			if (our_final_flush_task == null) {
				our_final_flush_task = new FinalFlushTask (this);

				our_final_flush_task.Tag = "Final Flush for " + IndexName;
				our_final_flush_task.Priority = Scheduler.Priority.Maintenance;
				our_final_flush_task.SubPriority = 100; // do this first when starting maintenance
				our_final_flush_task.Source = this;
			}
			
			ThisScheduler.Add (our_final_flush_task);
		}