Skip to content

Commit

Permalink
remove AsyncBuilder task overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis committed Jan 26, 2016
1 parent 1e51f17 commit 9c9da2e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/MBrace.Core/Library/CloudCollectionUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ type CloudCollection private () =
let webRequest = WebRequest.Create(url)
webRequest.Method <- "HEAD"
let task = webRequest.GetResponseAsync()
use! response = task
use! response = Async.AwaitTaskCorrect task
ignore response

return HTTPTextCollection(url, ?encoding = encoding)
Expand Down
9 changes: 1 addition & 8 deletions src/MBrace.Core/Utils/AsyncExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,4 @@ type Async =

match timeoutMilliseconds with
| None -> tcs.Task |> Async.AwaitTaskCorrect
| Some t -> Async.WithTimeout(tcs.Task |> Async.AwaitTaskCorrect, t)

/// AsyncBuilder Task extensions
type AsyncBuilder with
member inline b.Bind(f : Task<'T>, g : 'T -> Async<'S>) : Async<'S> = b.Bind(Async.AwaitTaskCorrect f, g)
member inline b.Bind(f : Task, g : unit -> Async<'S>) : Async<'S> = b.Bind(Async.AwaitTaskCorrect f, g)
member inline b.ReturnFrom(f : Task<'T>) : Async<'T> = b.ReturnFrom(Async.AwaitTaskCorrect f)
member inline b.ReturnFrom(f : Task) : Async<unit> = b.ReturnFrom(Async.AwaitTaskCorrect f)
| Some t -> Async.WithTimeout(tcs.Task |> Async.AwaitTaskCorrect, t)
4 changes: 2 additions & 2 deletions src/MBrace.Runtime/Store/FileSystemStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ type FileSystemStore private (rootPath : string, defaultDirectory : string) =
let target = normalize target
initDir <| Path.GetDirectoryName target
use! fs = retryAsync fileAccessRetryPolicy <| async { return new FileStream(target, FileMode.Create, FileAccess.Write, FileShare.None) }
do! source.CopyToAsync fs
do! source.CopyToAsync fs |> Async.AwaitTaskCorrect
}

member self.DownloadToStream(source : string, target : Stream) = async {
use! fs = (self :> ICloudFileStore).BeginRead source
do! fs.CopyToAsync target
do! fs.CopyToAsync target |> Async.AwaitTaskCorrect
}

member self.DownloadToLocalFile(source : string, target : string) = async {
Expand Down
4 changes: 2 additions & 2 deletions src/MBrace.Runtime/Utils/Serialization.fs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module FsPicklerExtensions =
if maxConcurrentContinuations |> Option.exists (fun cc -> cc < taskQueue.Count) then
// concurrent continuation limit has been reached,
// asynchronously wait until first task in queue has completed
let! result = taskQueue.Dequeue() // might raise excepton, but we are ok with this
let! result = taskQueue.Dequeue() |> Async.AwaitTaskCorrect // might raise excepton, but we are ok with this
results.Add result

// no restrictions, apply current chunk to continuation
Expand All @@ -93,7 +93,7 @@ module FsPicklerExtensions =
taskQueue.Enqueue task

for t in taskQueue do
let! result = t
let! result = Async.AwaitTaskCorrect t
results.Add result

return results.ToArray()
Expand Down

0 comments on commit 9c9da2e

Please sign in to comment.