private static long CreateExpirationEntry(StatelessSessionWrapper session, DateTime?expireAt)
        {
            session.DeleteAll <_AggregatedCounter>();
            var a = new _AggregatedCounter {
                Key = "key", Value = 1, ExpireAt = expireAt
            };

            session.Insert(a);

            return(a.Id);
        }
Ejemplo n.º 2
0
        public static _Job InsertNewJob(StatelessSessionWrapper session, Action <_Job> action = null)
        {
            var newJob = new _Job
            {
                InvocationData = string.Empty,
                Arguments      = string.Empty,
                CreatedAt      = session.Storage.UtcNow
            };

            action?.Invoke(newJob);
            session.Insert(newJob);

            return(newJob);
        }
        public void Enqueue(StatelessSessionWrapper session, string queue, string jobId)
        {
            var converter = StringToInt32Converter.Convert(jobId);

            if (!converter.Valid)
            {
                return;
            }

            session.Insert(new _JobQueue
            {
                Job   = session.Query <_Job>().SingleOrDefault(i => i.Id == converter.Value),
                Queue = queue
            });

            Logger.DebugFormat("Enqueued JobId={0} Queue={1}", jobId, queue);
        }