Ejemplo n.º 1
0
        /// <summary>
        ///  we now have a list of {id: ..., is_community_page: true/false} .. we process this list. all community pages dont get called, for the others we fetch the details and the events
        /// </summary>
        /// <param name="pages">a list of FacebookPagingResult objects that describe the FBPages that we want to crawl</param>
        /// <returns>nothing. but it's async.</returns>
        public async Task handlePagesList(List <FacebookPagingResult> pages)
        {
            foreach (var page in pages)
            {
                if (!page.is_community_page)
                {
                    try {
                        var pageInDb = pageRepo.GetByFbIdAsync(page.fbId).Result;

                        if (pageInDb == null)
                        {
                            var t = fetchAndStorePage(page.fbId); //only fetching events that arent in the DB yet.
                            var p = t.Result;
                            //for now we dont fetch events here anymore. we just get all the pages and place them in the DB. Another crawling task will take care of all the places and their events and fetch them.

                            /*if (determineIfEventsShouldBeFetched(p))
                             *  fetchEventsOnPage(p.fbId);*/
                        }
                    }
                    catch (Exception exception) {
                        Debug.WriteLine(exception); // TODO VERY DIRTY FIX ASAP
                    }
                }
            }
        }