static void CleanupFile(ClientMessage.ImportEvents msg) { try { File.Delete(msg.StagingLocation); } catch {} }
public void Handle(ClientMessage.ImportEvents msg) { Log.Info("Got import request for {0} bytes", msg.Size); var watch = Stopwatch.StartNew(); var count = 0; var size = 0; var blob = _config.GetPageBlob(msg.StagingLocation); _manager.AppendEventsToStore(msg.StoreId, msg.StreamId, EnumerateStaging(blob, msg.Size).Select(bytes => { count += 1; size += bytes.Length; return(bytes); })); var totalSeconds = watch.Elapsed.TotalSeconds; var speed = size / totalSeconds; Log.Info("Import {0} in {1}sec: {2} m/s or {3}", count, Math.Round(totalSeconds, 4), Math.Round(count / totalSeconds), FormatEvil.SpeedInBytes(speed)); msg.Envelope(new ClientMessage.ImportEventsCompleted()); ThreadPool.QueueUserWorkItem(state => CleanupBlob(blob)); }