コード例 #1
0
        public string Post(Wso2Request <Wso2Model> req)
        {
            var ev   = req.Event;
            var cell = ev.CellNumber;

            var timestamp = req.Event.Timestamp;

            if (req.Event.DropoffTime == null)
            {
                return("bypass");
            }

            QueryTime = Math.Max(QueryTime, req.Event.DropoffTime.Value);
            var _30minAgo = QueryTime - (30 * 60 * 1000);

            if (_30minAgo > req.Event.DropoffTime)
            {
                return("bypass");
            }

            lock (lockObject)
            {
                InMemoryData[cell] = req.Event;

                UpdateData(timestamp, req.Event.PickupTime.Value, req.Event.DropoffTime.Value, cell);
            }

            return("OK");
        }
コード例 #2
0
        public string Post(Wso2Request <Wso2Model> req)
        {
            QueryTime = Math.Max(QueryTime, req.Event.DropoffTime);
            var _30minAgo = QueryTime - (30 * 60 * 1000);

            if (_30minAgo > req.Event.DropoffTime)
            {
                return("bypass");
            }

            lock (lockObject)
            {
                var aggregatedCells = req.Event.AggregatedCells;
                var timestamp       = req.Event.Timestamp;

                if (InMemoryData.ContainsKey(aggregatedCells))
                {
                    InMemoryData[aggregatedCells].Add(req.Event.DropoffTime);
                }
                else
                {
                    InMemoryData[aggregatedCells] = new List <long>()
                    {
                        req.Event.DropoffTime
                    };
                }

                UpdateData(timestamp, req.Event.PickupTime, req.Event.DropoffTime, aggregatedCells);

                return("OK");
            }
        }
コード例 #3
0
        public object Post(Wso2Request <Wso2Model> input)
        {
            lock (lockObject)
            {
                var ts = input.Event.Now;
                CurrentTime = Math.Max(CurrentTime, ts);

                foreach (var item in Data)
                {
                    if (CurrentTime - 900000 > item.Value)
                    {
                        Data.TryRemove(item.Key, out long x);
                    }
                }


                Data[input.Event.CurrentProfit] = input.Event.Now;
            }

            return(new
            {
                profit = Median()
            });
        }