private static long CreateExpirationEntry(SessionWrapper session, DateTime?expireAt) { session.DeleteAll <_AggregatedCounter>(); var a = new _AggregatedCounter { Key = "key", Value = 1, ExpireAt = expireAt }; session.Insert(a); session.Flush(); return(a.Id); }
public static _Job InsertNewJob(SessionWrapper 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); session.Flush(); return(newJob); }
public void Enqueue(SessionWrapper 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 }); session.Flush(); Logger.InfoFormat("Enqueued JobId={0} Queue={1}", jobId, queue); }