private static void CollectPingNow(Database db) { int ping_id = -1; string sql = $"SELECT CollectorID FROM Collectors WHERE CollectorType = {(int)ECollectorType.Ping};"; using (SQLiteConnection conn = db.Connection) { conn.Open(); try { using (SQLiteCommand command = new SQLiteCommand(sql, conn)) using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.Read()) { ping_id = reader.GetInt32(0); } } } catch (Exception ex) { ILog log = LogManager.GetLogger(typeof(SystemConfigurationStore)); log.Error("Initialize: " + sql); log.Error(ex); } if (ping_id >= 0) { CollectionTime ct = new CollectionTime(conn); ct.CollectNow(ping_id); } } }
public BeingCollected(long collector_id, SQLiteConnection conn) { CollectorID = collector_id; Conn = conn; CollectionTime ct = new CollectionTime(Conn); ct.UpdateCollectionAttemptTime(collector_id, DateTimeOffset.Now); ct.UpdateNextCollectionTime(collector_id); ct.BeingCollected(collector_id, true); }
public void Dispose() { CollectionTime ct = new CollectionTime(Conn); ct.BeingCollected(CollectorID, false); }
public DBCollectionTimeRetriever(SQLiteConnection conn) { CollectionTime d = new CollectionTime(conn); m_collector_ids = new Queue <long>(d.GetCollectorIDs()); }