示例#1
0
        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);
                }
            }
        }
示例#2
0
        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);
        }
示例#3
0
        public void Dispose()
        {
            CollectionTime ct = new CollectionTime(Conn);

            ct.BeingCollected(CollectorID, false);
        }
示例#4
0
        public DBCollectionTimeRetriever(SQLiteConnection conn)
        {
            CollectionTime d = new CollectionTime(conn);

            m_collector_ids = new Queue <long>(d.GetCollectorIDs());
        }