Use TimeToLive (TimeSpan?) instead of TtlMs (long?) in public APIs (#1644)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: PranavSenthilnathan <12225508+PranavSenthilnathan@users.noreply.github.com>
Co-authored-by: halter73 <54385+halter73@users.noreply.github.com>
Co-authored-by: Pranav Senthilnathan <pranas@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Copilot 2026-06-23 09:12:15 -07:00 • committed by GitHub
commit 3368bb7349
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 85 deletions

View file

@ -21,7 +21,7 @@ public static class TaskSerializationTests
StatusMessage = "Processing...",
CreatedAt = new DateTimeOffset(2025, 6, 1, 12, 0, 0, TimeSpan.Zero),
LastUpdatedAt = new DateTimeOffset(2025, 6, 1, 12, 5, 0, TimeSpan.Zero),
TtlMs = 3600000,
TimeToLive = TimeSpan.FromHours(1),
PollIntervalMs = 5000,
ResultType = "task",
Meta = new JsonObject { ["key"] = "value" }
@ -36,7 +36,7 @@ public static class TaskSerializationTests
Assert.Equal("Processing...", deserialized.StatusMessage);
Assert.Equal(original.CreatedAt, deserialized.CreatedAt);
Assert.Equal(original.LastUpdatedAt, deserialized.LastUpdatedAt);
Assert.Equal(3600000, deserialized.TtlMs);
Assert.Equal(TimeSpan.FromHours(1), deserialized.TimeToLive);
Assert.Equal(5000, deserialized.PollIntervalMs);
Assert.Equal("task", deserialized.ResultType);
Assert.NotNull(deserialized.Meta);
@ -52,7 +52,7 @@ public static class TaskSerializationTests
Status = McpTaskStatus.Working,
CreatedAt = DateTimeOffset.UtcNow,
LastUpdatedAt = DateTimeOffset.UtcNow,
TtlMs = 60000,
TimeToLive = TimeSpan.FromMinutes(1),
PollIntervalMs = 1000,
ResultType = "task",
};

View file

@ -55,13 +55,13 @@ public class InMemoryMcpTaskStoreTests
}
[Fact]
public async Task CreateTaskAsync_UsesDefaultTtl()
public async Task CreateTaskAsync_UsesDefaultTimeToLive()
{
var store = new InMemoryMcpTaskStore { DefaultTtlMs = 30000 };
var store = new InMemoryMcpTaskStore { DefaultTimeToLive = TimeSpan.FromSeconds(30) };
var result = await store.CreateTaskAsync(CT);
Assert.Equal(30000, result.TtlMs);
Assert.Equal(TimeSpan.FromSeconds(30), result.TimeToLive);
}
[Fact]

View file

@ -34,7 +34,7 @@ public class TaskCancellationIntegrationTests : ClientServerTestBase
options.TaskStore = new InMemoryMcpTaskStore
{
DefaultPollIntervalMs = 50,
DefaultTtlMs = 5000,
DefaultTimeToLive = TimeSpan.FromSeconds(5),
};
});