anchor.diff:                  else
                       doc.Value <- doc.Value - value
   
  -            do! writeQueue.AddWithCallback ((docKey, doc,etag), complete)
  -
  -            do! wait |> Async.Ignore
  -        }
  +            do! writeQueue.Add((docKey, doc,etag, complete))
  +
  +            return! wait 
  +        }
  +        
  +    let processEvent (key:Guid) values = async {
  +        let rec loop () = async {
  +            let! attempt = tryEvent key values
  +            if not attempt then
  +                return! loop ()
  +            else 
  +                ()
  +        }
  +        do! loop ()
  +    }
   
       let queue = new WorktrackingQueue<Guid, Guid * int>(fst >> Set.singleton, processEvent, 10000, 10);
   
  
positive.code: 
      let cache = new MemoryCache("RavenBatchWrite")
  
      let writeBatch _ doc = async {
          let! (batchResult, docs) = BatchOperations.writeBatch documentStore doc
          let originalDocMap = 
              docs
              |> Seq.map (fun (key, doc, _) -> (key, doc))
              |> Map.ofSeq
  
          for docResult in batchResult do
              let doc = originalDocMap.[docResult.Key]
              cache.Set(docResult.Key, (doc, docResult.Etag) :> obj, DateTimeOffset.MaxValue) |> ignore
      }
  
      let writeQueue = new WorktrackingQueue<unit, BatchWrite>((fun _ -> Set.singleton ()), writeBatch, 10000, 10) 
  
negative.code: open Raven.Json.Linq
  
  module BatchOperations =
      let buildPutCommand (key, doc, etag, _) =
          let cmd = new PutCommandData()
          cmd.Document <- RavenJObject.FromObject(doc)
          cmd.Key <- key
  