コード例 #1
0
        private void PerformScheduledWork(object state)
        {
            // Perform your work here, but be mindful of the _shutdownEvent in case
            // the service is shutting down.
            //
            // Reschedule the work to be performed.

            try
            {
                using (var ctx = new Db())
                {
                    ctx.Database.CommandTimeout = 120;
                    ShinglesToProcess           = ShingleLogic.GetNextShingleList(ctx);
                    if (ShinglesToProcess == null || ShinglesToProcess.Count == 0)
                    {
                        System.Threading.Tasks.Task.Delay(20000);
                    }
                    else
                    {
                        foreach (var s in ShinglesToProcess)
                        {
                            ShingleLogic.AnalyzeShingle(s);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                DataLayer.LogException(e);
            }
            finally
            {
                _scheduleTimer.Start();
            }
        }
コード例 #2
0
ファイル: Service.cs プロジェクト: karelzarsky/Syndication
 private void PerformShingleProcessing(object state)
 {
     //DataLayer.LogMessage(LogLevel.Service, "Processing Invoked");
     try
     {
         //DataLayer.LogMessage(LogLevel.Info, "New processing run scheduled.");
         using (var ctx = new Db())
         {
             ctx.Database.CommandTimeout = 120;
             ShinglesToProcess           = ShingleLogic.GetNextShingleList(ctx);
             if (ShinglesToProcess == null || ShinglesToProcess.Count == 0)
             {
                 System.Threading.Tasks.Task.Delay(20000);
             }
             //                        Thread.Sleep(20000);
             else
             {
                 foreach (var s in ShinglesToProcess)
                 {
                     ShingleLogic.AnalyzeShingle(s);
                 }
             }
         }
     }
     catch (Exception e)
     {
         DataLayer.LogException(e);
     }
     finally
     {
         thProcessShingles.timer.Start();
     }
 }
コード例 #3
0
ファイル: Analysis.cs プロジェクト: karelzarsky/Syndication
        static void Main(string[] args)
        {
            using (Process p = Process.GetCurrentProcess())
                p.PriorityClass = ProcessPriorityClass.Idle;

            var ctx = new Db();

            ctx.Database.CommandTimeout = 120;
            var shingleArray = ShingleLogic.GetNextShingles(ctx);

            while (shingleArray.Length > 0)
            {
                foreach (int ShingleID in shingleArray)
                {
                    ShingleLogic.AnalyzeShingle(ShingleID);
                }
                shingleArray = ShingleLogic.GetNextShingles(ctx);
            }
        }