Skip to content

Commit

Permalink
Fix to correctly handle query TTL (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonhopes authored Dec 12, 2022
1 parent 16884c4 commit 0c123f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Consul.Test/PreparedQueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// </copyright>
// -----------------------------------------------------------------------

using System;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
Expand Down Expand Up @@ -59,6 +60,10 @@ public async Task PreparedQuery_Test()
Service = "sql",
Near = "_agent",
OnlyPassing = true
},
DNS = new QueryDNSOptions
{
TTL = TimeSpan.FromSeconds(5)
}
};

Expand Down
1 change: 1 addition & 0 deletions Consul/PreparedQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class QueryDNSOptions
/// <summary>
/// TTL is the time to live for the served DNS results.
/// </summary>
[JsonConverter(typeof(DurationTimespanConverter))]
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public TimeSpan? TTL { get; set; }
}
Expand Down

0 comments on commit 0c123f1

Please sign in to comment.