Ejemplo n.º 1
0
        public async Task Perform()
        {
            List <BacklinkRow> list = new List <BacklinkRow>();

            for (int i = 0; i < _settings.PlainHttpThreads; i++)
            {
                DataBacklinkRow datarow = await _dataBacklinkRowService.GetFirstDataBacklinkRowByStatus(CurrentTaskStatus);

                datarow.Status = Status.PlainHttp;
                await _dataBacklinkRowService.UpdateDataBacklinkRow(datarow);

                list.Add(new BacklinkRow()
                {
                    DataBacklinkRow = datarow
                });
            }


            _plainHttp = new PlainHttp(_settings.PlainHttpThreads, FreeThread);
            await _plainHttp.Perform(list);

            list.Clear();
            CurrentTaskStatus = Status.PlainHttpNotFound;
            _dbQueue          = new DbQueue(_settings.ConnectionString, _settings.PlainHttpThreads, _settings.Positions);
            for (int i = 0; i < _settings.WebDriverThreads; i++)
            {
                DataBacklinkRow datarow = await _dataBacklinkRowService.GetFirstDataBacklinkRowByStatus(CurrentTaskStatus);

                if (datarow == null)
                {
                    _settings.WebDriverThreads = i;
                    break;
                }
                datarow.Status = Status.WebDriver;
                await _dataBacklinkRowService.UpdateDataBacklinkRow(datarow);

                list.Add(new BacklinkRow()
                {
                    DataBacklinkRow = datarow
                });
            }
            _webDriver = new WebDriver(_settings.WebDriverThreads, FreeThread);
            await _webDriver.Perform(list);

            _webDriver.Quit();
        }
Ejemplo n.º 2
0
        private async Task <BacklinkRow> FreeThread(BacklinkRow row)
        {
            DataBacklinkRowService serv1 = new DataBacklinkRowService(_settings.ConnectionString);
            DataTagAService        serv2 = new DataTagAService(_settings.ConnectionString);

            await serv1.UpdateDataBacklinkRow(row.DataBacklinkRow);

            if (row.DataTagA != null)
            {
                await serv2.CreateDataTagA(row.DataTagA);
            }

            DataBacklinkRow datarow = _dbQueue.Get();

            BacklinkRow newrow = new BacklinkRow()
            {
                DataBacklinkRow = datarow
            };

            return(newrow);
        }