Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/Jobs/JobsSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Dapr.Jobs.Models;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDaprJobsClient();
builder.Logging.ClearProviders();
builder.Logging.AddConsole();

Expand Down
12 changes: 8 additions & 4 deletions src/Dapr.Jobs/DaprJobsGrpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,15 @@ public override async Task<DaprJobDetails> GetJobAsync(string jobName, Cancellat
var envelope = new Autogenerated.GetJobRequest { Name = jobName };
var grpcCallOptions = DaprClientUtilities.ConfigureGrpcCallOptions(typeof(DaprJobsClient).Assembly, this.DaprApiToken, cancellationToken);
var response = await Client.GetJobAlpha1Async(envelope, grpcCallOptions);
return new DaprJobDetails(new DaprJobSchedule(response.Job.Schedule))
var schedule = DateTime.TryParse(response.Job.DueTime, out var dueTime)
? DaprJobSchedule.FromDateTime(dueTime)
: new DaprJobSchedule(response.Job.Schedule);

return new DaprJobDetails(schedule)
{
DueTime = response.Job.DueTime is not null ? DateTime.Parse(response.Job.DueTime) : null,
Ttl = response.Job.Ttl is not null ? DateTime.Parse(response.Job.Ttl) : null,
RepeatCount = response.Job.Repeats == default ? null : (int?)response.Job.Repeats,
DueTime = !string.IsNullOrWhiteSpace(response.Job.DueTime) ? DateTime.Parse(response.Job.DueTime) : null,
Ttl = !string.IsNullOrWhiteSpace(response.Job.Ttl) ? DateTime.Parse(response.Job.Ttl) : null,
RepeatCount = (int?)response.Job.Repeats,
Payload = response.Job.Data.ToByteArray()
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dapr.Jobs/Models/DaprJobSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static DaprJobSchedule FromDuration(TimeSpan duration)
/// <summary>
/// Specifies a schedule in which the job is triggered weekly.
/// </summary>
public static DaprJobSchedule Weekly { get; } =new DaprJobSchedule("@weekly");
public static DaprJobSchedule Weekly { get; } = new DaprJobSchedule("@weekly");

/// <summary>
/// Specifies a schedule in which the job is triggered daily.
Expand Down
Loading