Skip to content

Instantly share code, notes, and snippets.

@eiriktsarpalis
Created May 4, 2014 14:19
Show Gist options
  • Save eiriktsarpalis/e477b8c9602769c34d0f to your computer and use it in GitHub Desktop.
Save eiriktsarpalis/e477b8c9602769c34d0f to your computer and use it in GitHub Desktop.
Still unable to reproduce
#I "bin/Debug"
#r "FsPickler.dll"
#r "HouseHunter.exe"
open System.Threading
open System.IO
open Nessos.FsPickler
open HouseHunter
let cts = new System.Threading.CancellationTokenSource()
let crawler = new Crawler((fun _ -> async.Zero()), ignore, [ Zoopla.T() ])
Async.Start(crawler.Crawl(0m, 100000m, 0, 100), cancellationToken = cts.Token)
// wait until data is collected
do cts.Cancel()
// just a property that publishes the current crawler state
let state = crawler.State
let fsp = new FsPickler()
let file = __SOURCE_DIRECTORY__ + "/bin/Debug/foo.bin"
using (File.OpenWrite file) (fun fs -> fsp.Serialize(fs, state))
let data = using (File.OpenRead file) (fun fs -> fsp.Deserialize<Map<string, Property>>(fs))
data = state // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment