Пример #1
0
        public void PostPacket(IEnumerable <DataRecord> resources)
        {
            Debug.Assert(resources != null, "resource!=null");
            var notWrittenResources =
                _packetResourcePosters.
                Aggregate(resources,
                          (a, s) =>
            {
                if (a.Any())
                {
                    var w = Stopwatch.StartNew();
                    a     = s.PostResourceBlock(a).ToArray();
                    w.Stop();

                    _statChannel.SendMessageAboutMultipleResources(new Guid[3], Actions.Posted,
                                                                   w.Elapsed);
                }
                return(a);
            });

            foreach (var dataRecord in resources)
            {
                if (!notWrittenResources.Any(k => k.Content == dataRecord.Content))
                {
                    dataRecord.UpdateSender();
                }
            }
            if (notWrittenResources != null && notWrittenResources.Any())
            {
                EmulatedSerialPost(notWrittenResources);
            }
        }
Пример #2
0
        internal IEnumerable <KeyValuePair <Guid, object> > GetItems(IEnumerable <Guid> id)
        {
            var t     = Stopwatch.StartNew();
            var ids   = id.ToArray();
            var items = GetItemsInt(ids);

            t.Stop();
            StatChannel.SendMessageAboutMultipleResources(ids.ToArray(), Actions.ExternalGet, t.Elapsed);
            return(items);
        }