Skip to content

Commit

Permalink
Rebase Ingest on Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Apr 14, 2019
1 parent 7587b2c commit 8302f0e
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 445 deletions.
18 changes: 7 additions & 11 deletions equinox-ingest/Ingest/Infrastructure.fs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[<AutoOpen>]
module private IngestTemplate.Infrastructure
module private Infrastructure

open Equinox.Store // AwaitTaskCorrect
open System
Expand All @@ -15,16 +15,12 @@ type SemaphoreSlim with
return! Async.AwaitTaskCorrect task
}

module Queue =
let tryDequeue (x : System.Collections.Generic.Queue<'T>) =
#if NET461
if x.Count = 0 then None
else x.Dequeue() |> Some
#else
match x.TryDequeue() with
| false, _ -> None
| true, res -> Some res
#endif
/// Throttling wrapper which waits asynchronously until the semaphore has available capacity
member semaphore.Throttle(workflow : Async<'T>) : Async<'T> = async {
let! _ = semaphore.Await()
try return! workflow
finally semaphore.Release() |> ignore
}

#nowarn "21" // re AwaitKeyboardInterrupt
#nowarn "40" // re AwaitKeyboardInterrupt
Expand Down
1 change: 1 addition & 0 deletions equinox-ingest/Ingest/Ingest.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<ItemGroup>
<Compile Include="Infrastructure.fs" />
<Compile Include="..\..\equinox-sync\Sync\CosmosIngester.fs" Link="CosmosIngester.fs" />
<Compile Include="Program.fs" />
</ItemGroup>

Expand Down
Loading

0 comments on commit 8302f0e

Please sign in to comment.