|
5 | 5 | using System.Threading.Tasks; |
6 | 6 | using Microsoft.Extensions.Logging; |
7 | 7 | using NuGet.Jobs.Extensions; |
| 8 | +using StatusAggregator.Collector; |
| 9 | +using StatusAggregator.Update; |
8 | 10 |
|
9 | 11 | namespace StatusAggregator.Export |
10 | 12 | { |
11 | 13 | public class StatusExporter : IStatusExporter |
12 | 14 | { |
| 15 | + private readonly ICursor _cursor; |
13 | 16 | private readonly IComponentExporter _componentExporter; |
14 | 17 | private readonly IEventsExporter _eventExporter; |
15 | 18 | private readonly IStatusSerializer _serializer; |
16 | 19 |
|
17 | 20 | private readonly ILogger<StatusExporter> _logger; |
18 | 21 |
|
19 | 22 | public StatusExporter( |
| 23 | + ICursor cursor, |
20 | 24 | IComponentExporter componentExporter, |
21 | 25 | IEventsExporter eventExporter, |
22 | 26 | IStatusSerializer serializer, |
23 | 27 | ILogger<StatusExporter> logger) |
24 | 28 | { |
| 29 | + _cursor = cursor ?? throw new ArgumentNullException(nameof(cursor)); |
25 | 30 | _componentExporter = componentExporter ?? throw new ArgumentNullException(nameof(componentExporter)); |
26 | 31 | _eventExporter = eventExporter ?? throw new ArgumentNullException(nameof(eventExporter)); |
27 | 32 | _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); |
28 | 33 | _logger = logger ?? throw new ArgumentNullException(nameof(logger)); |
29 | 34 | } |
30 | 35 |
|
31 | | - public Task Export(DateTime cursor) |
| 36 | + public async Task Export(DateTime cursor) |
32 | 37 | { |
33 | 38 | using (_logger.Scope("Exporting service status.")) |
34 | 39 | { |
35 | 40 | var rootComponent = _componentExporter.Export(); |
36 | 41 | var recentEvents = _eventExporter.Export(cursor); |
37 | | - return _serializer.Serialize(cursor, rootComponent, recentEvents); |
| 42 | + |
| 43 | + var lastUpdated = await _cursor.Get(StatusUpdater.LastUpdatedCursorName); |
| 44 | + await _serializer.Serialize(cursor, lastUpdated, rootComponent, recentEvents); |
38 | 45 | } |
39 | 46 | } |
40 | 47 | } |
|
0 commit comments