public async Task <ReportActivityResult> ExecuteAsync(ReportActivity command, CancellationToken cancellationToken) { await repository.SetServiceLastActiveAsync(command.LastActiveUtc, cancellationToken); TimeSpan expirationQuanta = await repository.GetExpirationQuantaAsync(cancellationToken); return(new ReportActivityResult(TimeSpan.FromMilliseconds(expirationQuanta.TotalMilliseconds / 3))); }
public async Task <OccupyInstanceResult> ExecuteAsync(OccupyInstance command, CancellationToken cancellationToken) { Uri serviceUri = await repository.GetServiceUriAsync(cancellationToken); await instanceProxy.OccupyAsync(serviceUri, command.InstanceId, command.InstanceName); await Task.WhenAll( repository.SetServiceInstanceName(command.InstanceName, cancellationToken), repository.SetPartitionIdAsync(command.PartitionId, cancellationToken), repository.SetServiceLastActiveAsync(DateTime.UtcNow, cancellationToken) ); return(new OccupyInstanceResult(serviceUri)); }