Exemplo n.º 1
0
        /**************************
        *   ===== Processing =====
        **************************/

        private void ProcessThread(int id, string html)
        {
            if (String.IsNullOrEmpty(html))
            {
                DatabaseQueue.Enqueue(new DbModels.Thread()
                {
                    Id = id
                });
                TelemetryManager.IncrimentEmptyThreads();
                return;
            }

            RobloxThread thread = new RobloxThread(id);

            thread.AddPage(html);
            if (thread.IsEmpty)
            {
                DatabaseQueue.Enqueue(new DbModels.Thread()
                {
                    Id = id
                });
                TelemetryManager.IncrimentEmptyThreads();
                return;
            }
            if (thread.PagesCount > 1 && thread.CurrentPage < thread.PagesCount)
            {
                PageDownloadingQueue.Enqueue(thread);
                return;
            }

            DbModels.Thread dbThread = thread.ToDbThread();
            DatabaseQueue.Enqueue(dbThread);
            thread = null; //TODO: Evaluate necessity
            return;
        }
Exemplo n.º 2
0
 //Return value indicates if the thread is finished or not
 private bool ProcessThreadPage(RobloxThread thread, string html)
 {
     if (String.IsNullOrEmpty(html))
     {
         thread.Errors += $"; Page {thread.CurrentPage} is error";
         return(true);
     }
     thread.AddPage(html);
     if (thread.CurrentPage < thread.PagesCount)
     {
         PageDownloadingQueue.Enqueue(thread);
         return(false);
     }
     return(true);
 }