public async Task <bool> SaveUnstableRecord(UnstableRuleRecord newRecord) { if (!createConnection()) { // failed to establish connection return(false); } var dbRecord = new UnstableServiceDbRecord( newRecord.serviceId, newRecord.downCount, newRecord.downEvents, newRecord.time); var collection = database.GetCollection <UnstableServiceDbRecord>( config.unstableRecordCollection); try { await collection.InsertOneAsync(dbRecord); return(true); } catch (TimeoutException) { Console.WriteLine($"Failed to connect with the database on: " + $"{config.dbAddress} ... "); return(false); } }
public UnstableServiceRequest(UnstableRuleRecord record) { this.record = record; }