/************************** * ===== 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; }
//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); }