public int StartBatch(string[] filenames, string environment, string username) { int batchId = Interlocked.Increment(ref _lastBatchId); List <int> taskIds = new List <int>(filenames.Length); foreach (string filename in filenames) { var taskRequest = new TaskRequest { Environment = environment, Filename = filename, Username = username }; int taskId = _testFileQueue.Add(taskRequest); taskIds.Add(taskId); } // cache batch info only for a limited time... string key = $"{KeyPrefix}{batchId}"; _objectCache.Set(key, taskIds, DateTimeOffset.Now.AddHours(1)); return(batchId); }
public int Start(TaskRequest item) { return(_fileQueue.Add(item)); }