Closed hmol closed 8 years ago
Hi! A novice programmer here. I would like to work on this.
hello @sourangshu24 This task could be a bit more complicated than I first thought. Since the application is using asynch functions, you need to research how you can know when the program is finished running. Maybe we need to change some parts of the LinkCrawler.cs.
Hi @hmol ! I was thinking more on the lines of modifying Program.cs to store the local system times ( for start and end times) before a call to linkCrawler.Start() is made and before Console.Read() is called respectively. I supppose even async calls will finish by the time control jumps back to Program.cs to call Console.Read(). Please correct me if I am wrong and if my approach is wrong.
Yeah, you can clone my repo and test it if you want :)
Read about async here https://msdn.microsoft.com/en-us/library/mt674882.aspx
Thing is, all the method-calls that will fetch markup and find broken links will be async. So I suspect that the program will go to Console.Read()
before it has finished the crawling.
Put Console.WriteLine("This is the end.")
in line above Console.Read()
to test.
I tested it as you suggested, and you are right! It does show "This is the end" at the beginning. Going back to your earlier suggestion of changing the LinkCrawler.cs file itself, i think a Stopwatch object should do the trick if i include it before calling the async function. But I need to research how to know when an async function has stopped executing.
@hmol, I have sent a pull request for this https://github.com/hmol/LinkCrawler/pull/18/commits/f4f3b35822d3abe3bf9c8bc47a95f19f207a82f7
Thanks, Yash
Think I've got a solution to this. Don't want to tread on any toes though - is anyone else actively working on this?
When program is finished running, write elapsed time to console output.