Conversation
DedSec256
reviewed
May 30, 2024
HW_7/HW_7.Tests/UnitTestLazy.fs
Outdated
|
|
||
| let ``suppliers single thread`` = | ||
| seq { | ||
| TestCaseData(fun () -> (+) (random.Next(10)) <| random.Next(10)) |
DedSec256
reviewed
May 31, 2024
HW_7/HW_7/MiniCrawler.fs
Outdated
Comment on lines
+34
to
+43
| |> Seq.map (fun link -> | ||
| async { | ||
| try | ||
| let! content = readPage link | ||
| return Some (String.concat " " [link; content.Length.ToString()]) | ||
| with | ||
| | :? WebException -> return None | ||
| } |> Async.StartAsTask) | ||
| |> Task.WhenAll | ||
| |> Async.AwaitTask |
There was a problem hiding this comment.
Suggested change
| |> Seq.map (fun link -> | |
| async { | |
| try | |
| let! content = readPage link | |
| return Some (String.concat " " [link; content.Length.ToString()]) | |
| with | |
| | :? WebException -> return None | |
| } |> Async.StartAsTask) | |
| |> Task.WhenAll | |
| |> Async.AwaitTask | |
| |> Seq.map (fun link -> | |
| async { | |
| try | |
| let! content = readPage link | |
| return Some (String.concat " " [link; content.Length.ToString()]) | |
| with | |
| | :? WebException -> return None | |
| }) | |
| |> Async.Parallel |
DedSec256
reviewed
May 31, 2024
HW_7/HW_7/MiniCrawler.fs
Outdated
| async { | ||
| try | ||
| let! content = readPage link | ||
| return Some (String.concat " " [link; content.Length.ToString()]) |
DedSec256
reviewed
May 31, 2024
HW_7/HW_7/MiniCrawler.fs
Outdated
Comment on lines
+48
to
+57
| for content in content do | ||
| match content with | ||
| | Some string -> | ||
| if (counter = 0) then | ||
| result <- String.concat "" [result; string] | ||
| counter <- 1 | ||
| else | ||
| result <- String.concat "\n" [result; string] | ||
| | None -> () | ||
| return Some result |
There was a problem hiding this comment.
это все не нужно, лучше просто вернуть результат
DedSec256
reviewed
May 31, 2024
HW_7/HW_7.Tests/UnitTestLazy.fs
Outdated
Comment on lines
+64
to
+65
| |> Option.get | ||
| |> should equal "https://edu.spbu.ru/maps/map.html 107400" |
There was a problem hiding this comment.
Suggested change
| |> Option.get | |
| |> should equal "https://edu.spbu.ru/maps/map.html 107400" | |
| |> should equal (Some("https://edu.spbu.ru/maps/map.html", 107400)) |
DedSec256
reviewed
May 31, 2024
HW_7/HW_7/MiniCrawler.fs
Outdated
Comment on lines
+15
to
+18
| use! response = request.AsyncGetResponse() | ||
| use reader = new StreamReader(response.GetResponseStream()) | ||
| let html = reader.ReadToEnd() | ||
| return html |
DedSec256
reviewed
Jun 1, 2024
| with | ||
| | :? WebException -> | ||
| raise (WebException "Incorrect url") | ||
| return None |
There was a problem hiding this comment.
Эта строчка недостижима, ведь выше кидается эксепшен
|
|
||
| return Some content | ||
| with | ||
| | :? WebException -> |
There was a problem hiding this comment.
В одном случае вы ловите HttpRequestException, в другом WebException, хотя логика одна. Подозрительно.
| match result with | ||
| | Some sizes -> | ||
| Assert.AreEqual(2, sizes.Length) | ||
| Assert.Contains(("https://example.com/page1", Some 14), sizes) |
There was a problem hiding this comment.
Лучше уж сразу весь список сравнить, чем поэлементно
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.