public ulong AddProblem(ProblemDefinition def) { lock (lockObj) { var id = counter++; logger.Info($"Adding new problem of type {def.Type} and id {id}."); problems.Add(id, new Problem(id, def)); return(id); } }
public void AddProblem(ProblemDefinition def, ulong forcedId) { lock (lockObj) { // TODO: detect why we have two messages in the queue! if (!problems.ContainsKey(forcedId)) { logger.Info($"Adding new problem of type {def.Type} and id {forcedId}."); problems.Add(forcedId, new Problem(forcedId, def)); counter = Math.Max(counter, forcedId + 1); } } }
public Problem(ulong id, ProblemDefinition def) { Id = id; Type = def.Type; Data = def.Data; }